diff --git a/vm/k3s-vm.sh b/vm/k3s-vm.sh index da2f90d5..64dbc030 100644 --- a/vm/k3s-vm.sh +++ b/vm/k3s-vm.sh @@ -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