diff --git a/prepare-labs/lib/commands.sh b/prepare-labs/lib/commands.sh index abcbe509..cc4c21d3 100644 --- a/prepare-labs/lib/commands.sh +++ b/prepare-labs/lib/commands.sh @@ -230,7 +230,7 @@ _cmd_create() { ;; *) die "Invalid mode: $MODE (supported modes: mk8s, pssh)." ;; esac - + if ! [ -f "$SETTINGS" ]; then die "Settings file ($SETTINGS) not found." fi @@ -562,6 +562,15 @@ EOF" kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl && echo 'alias k=kubecolor' | sudo tee /etc/bash_completion.d/k && echo 'complete -F __start_kubectl k' | sudo tee -a /etc/bash_completion.d/k" + + # Install helm early + # (so that we can use it to install e.g. Cilium etc.) + pssh " + if [ ! -x /usr/local/bin/helm ]; then + curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get-helm-3 | sudo bash && + helm completion bash | sudo tee /etc/bash_completion.d/helm + helm version + fi" } _cmd kubeadm "Setup kubernetes clusters with kubeadm" @@ -585,6 +594,17 @@ _cmd_kubeadm() { # Initialize kube control plane pssh --timeout 200 " + IPV6=\$(ip -json a | jq -r '.[].addr_info[] | select(.scope==\"global\" and .family==\"inet6\") | .local' | head -n1) + if [ \"\$IPV6\" ]; then + ADVERTISE=\"advertiseAddress: \$IPV6\" + SERVICE_SUBNET=\"serviceSubnet: fdff::/112\" + touch /tmp/install-cilium-ipv6-only + else + ADVERTISE= + SERVICE_SUBNET= + touch /tmp/install-weave + fi + echo IPV6=\$IPV6 ADVERTISE=\$ADVERTISE if i_am_first_node && [ ! -f /etc/kubernetes/admin.conf ]; then kubeadm token generate > /tmp/token && cat >/tmp/kubeadm-config.yaml <