From 153a5b8e59b353a86d5dea5cc2c350fcde383bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Sun, 9 Nov 2025 19:47:32 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=9C=20Bring=20IPv6=20support=20to=20ku?= =?UTF-8?q?beadm=20deployments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple small changes to allow deployment in IPv6-only environments. What we do: - detect if we are in an IPv6-only environment - if yes, specify a service CIDR and listening address (kubeadm will otherwise pick the IPv4 address for the API server) - switch to Cilium Also minor changes to pssh and terraform to handle pinging and connecting to IPv6 addresses. --- prepare-labs/lib/commands.sh | 47 +++++++++++++++++-- .../terraform/virtual-machines/common.tf | 3 +- 2 files changed, 44 insertions(+), 6 deletions(-) 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 <