🔧 Pass kubernetesVersion: in kubeadm config file

This commit is contained in:
Jérôme Petazzoni
2023-05-17 19:04:32 +02:00
parent d4a9ea2461
commit c1f8177f4e
2 changed files with 3 additions and 8 deletions

View File

@@ -453,6 +453,7 @@ _cmd_kube() {
need_tag
if [ "$KUBEVERSION" ]; then
CLUSTER_CONFIGURATION_KUBERNETESVERSION='kubernetesVersion: "v'$KUBEVERSION'"'
pssh "
sudo tee /etc/apt/preferences.d/kubernetes <<EOF
Package: kubectl kubeadm kubelet
@@ -480,13 +481,6 @@ EOF"
echo 'alias k=kubectl' | sudo tee /etc/bash_completion.d/k &&
echo 'complete -F __start_kubectl k' | sudo tee -a /etc/bash_completion.d/k"
# Disable swap
# (note that this won't survive across node reboots!)
if [ "$INFRACLASS" = "linode" ]; then
pssh "
sudo swapoff -a"
fi
# Install a valid configuration for containerd
# (first, the CRI interface needs to be re-enabled;
# also, the correct systemd cgroup driver must be selected,
@@ -527,6 +521,7 @@ apiVersion: kubeadm.k8s.io/v1beta3
apiServer:
certSANs:
- \$(cat /tmp/ipv4)
$CLUSTER_CONFIGURATION_KUBERNETESVERSION
EOF
sudo kubeadm init --config=/tmp/kubeadm-config.yaml
fi"

View File

@@ -7,7 +7,7 @@ USER_PASSWORD=training
# For a list of old versions, check:
# https://kubernetes.io/releases/patch-releases/#non-active-branch-history
KUBEVERSION=1.22.17
KUBEVERSION=1.22.5
STEPS="
wait