mirror of
https://github.com/JamesTurland/JimsGarage.git
synced 2026-08-04 14:56:42 +00:00
K3S-Deploy: fix k3sup install and kube-vip placement (from e2e)
Found running the deploy end-to-end on a multi-node cluster: - k3sup: get.k3sup.dev leaves an arch-suffixed binary (k3sup-arm64) when run unprivileged; install whichever binary it produced, not a literal 'k3sup' that may not exist. - kube-vip: scp landed the manifest in the ssh user's home, but the mv ran as root (sudo bash -s) where ~ is /root; scp to /tmp and mv from the absolute path instead.
This commit is contained in:
@@ -135,7 +135,16 @@ step "Step 1/9 · Local tools (k3sup, kubectl)"
|
|||||||
if ! command -v k3sup &>/dev/null; then
|
if ! command -v k3sup &>/dev/null; then
|
||||||
info "Installing k3sup"
|
info "Installing k3sup"
|
||||||
curl -sLS https://get.k3sup.dev | sh
|
curl -sLS https://get.k3sup.dev | sh
|
||||||
sudo install k3sup /usr/local/bin/
|
# The installer leaves the binary in the CWD — named "k3sup", or
|
||||||
|
# "k3sup-<arch>" when run unprivileged (it can't self-install to
|
||||||
|
# /usr/local/bin). Install whichever it produced.
|
||||||
|
k3sup_bin=""
|
||||||
|
for f in k3sup k3sup-*; do
|
||||||
|
[[ -f "$f" ]] && { k3sup_bin="$f"; break; }
|
||||||
|
done
|
||||||
|
[[ -n "$k3sup_bin" ]] || die "k3sup installer produced no binary"
|
||||||
|
sudo install "$k3sup_bin" /usr/local/bin/k3sup
|
||||||
|
rm -f k3sup k3sup-*
|
||||||
else
|
else
|
||||||
ok "k3sup present"
|
ok "k3sup present"
|
||||||
fi
|
fi
|
||||||
@@ -239,11 +248,13 @@ sed "s/REPLACE_INTERFACE/$interface/g; s/REPLACE_VIP/$vip/g" \
|
|||||||
"$HOME/kube-vip.src" > "$HOME/kube-vip.yaml"
|
"$HOME/kube-vip.src" > "$HOME/kube-vip.yaml"
|
||||||
for node in "${masters_all[@]}"; do
|
for node in "${masters_all[@]}"; do
|
||||||
info "Placing kube-vip manifest on $node"
|
info "Placing kube-vip manifest on $node"
|
||||||
scp "${ssh_opts[@]}" "$HOME/kube-vip.yaml" "$user@$node:~/kube-vip.yaml" >/dev/null
|
# scp to /tmp (absolute) — the mv below runs as root, where ~ is /root,
|
||||||
|
# not the ssh user's home where scp would otherwise land the file.
|
||||||
|
scp "${ssh_opts[@]}" "$HOME/kube-vip.yaml" "$user@$node:/tmp/kube-vip.yaml" >/dev/null
|
||||||
ssh "${ssh_opts[@]}" "$user@$node" 'sudo bash -s' <<'REMOTE'
|
ssh "${ssh_opts[@]}" "$user@$node" 'sudo bash -s' <<'REMOTE'
|
||||||
set -e
|
set -e
|
||||||
mkdir -p /var/lib/rancher/k3s/server/manifests
|
mkdir -p /var/lib/rancher/k3s/server/manifests
|
||||||
mv ~/kube-vip.yaml /var/lib/rancher/k3s/server/manifests/kube-vip.yaml
|
mv /tmp/kube-vip.yaml /var/lib/rancher/k3s/server/manifests/kube-vip.yaml
|
||||||
chown root:root /var/lib/rancher/k3s/server/manifests/kube-vip.yaml
|
chown root:root /var/lib/rancher/k3s/server/manifests/kube-vip.yaml
|
||||||
chmod 600 /var/lib/rancher/k3s/server/manifests/kube-vip.yaml
|
chmod 600 /var/lib/rancher/k3s/server/manifests/kube-vip.yaml
|
||||||
REMOTE
|
REMOTE
|
||||||
|
|||||||
Reference in New Issue
Block a user