fix(k3s-vm): upload k9s archive into image during customize

This commit is contained in:
CanbiZ (MickLesk)
2026-04-24 11:25:00 +02:00
parent 4d18972eb4
commit 67f9570981

View File

@@ -469,9 +469,26 @@ else
qm resize $VMID scsi0 ${DEFAULT_DISK_SIZE} >/dev/null
fi
case "$(dpkg --print-architecture)" in
amd64)
K9S_ARCH="amd64"
;;
arm64)
K9S_ARCH="arm64"
;;
*)
K9S_ARCH="amd64"
;;
esac
K9S_URL="https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_${K9S_ARCH}.tar.gz"
msg_info "Downloading k9s archive (${K9S_ARCH})"
curl -fsSL "$K9S_URL" -o /tmp/k9s.tar.gz
msg_ok "Downloaded k9s archive"
msg_info "Add in Image K3s, Helm & k9s"
virt-customize -q -a "${FILE}" \
--hostname "${HN}" \
--upload /tmp/k9s.tar.gz:/tmp/k9s.tar.gz \
--install curl,wget,tar,ca-certificates,gnupg,iptables \
--run-command 'curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644' \
--run-command 'ln -sf /usr/local/bin/k3s /usr/local/bin/kubectl' \
@@ -479,11 +496,12 @@ virt-customize -q -a "${FILE}" \
--run-command 'tar -xzf /tmp/helm.tar.gz -C /tmp' \
--run-command 'mv /tmp/linux-amd64/helm /usr/local/bin/helm' \
--run-command 'chmod +x /usr/local/bin/helm' \
--run-command 'wget -q https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_amd64.tar.gz -O /tmp/k9s.tar.gz' \
--run-command 'tar -xzf /tmp/k9s.tar.gz -C /usr/local/bin k9s' \
--run-command 'chmod +x /usr/local/bin/k9s' \
--run-command 'echo "export KUBECONFIG=/etc/rancher/k3s/k3s.yaml" >> /root/.bashrc' >/dev/null
rm -f /tmp/k9s.tar.gz
msg_ok "Added in Image K3s, Helm & k9s"
if [[ "$INSTALL_ARGOCD_BOOTSTRAP" == "1" ]]; then