From 4f8e288d2b2c0c8537137fbd79bcf2c383e3503d Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Tue, 24 Sep 2024 17:49:39 +0900 Subject: [PATCH] gh-87 : Updating scripts inline with PR #808 --- .../node_scripts/common.sh | 81 +++++++++++-------- .../node_scripts/master.sh | 7 +- .../yaml/kubeadm-config.yaml | 5 ++ 3 files changed, 56 insertions(+), 37 deletions(-) diff --git a/cicd/k8s-calico-ipsec-ha/node_scripts/common.sh b/cicd/k8s-calico-ipsec-ha/node_scripts/common.sh index c01ad688f..ded6b8b5d 100644 --- a/cicd/k8s-calico-ipsec-ha/node_scripts/common.sh +++ b/cicd/k8s-calico-ipsec-ha/node_scripts/common.sh @@ -15,6 +15,7 @@ cat </dev/null; echo "@reboot /sbin/swapoff -a") | crontab - || true sudo apt-get update -y -# Install CRI-O Runtime -VERSION="$(echo ${KUBERNETES_VERSION} | grep -oE '[0-9]+\.[0-9]+')" -CRIO_VERSION=1.27 -# Create the .conf file to load the modules at bootup -cat <> /etc/default/crio << EOF -${ENVIRONMENT} -EOF -sudo systemctl daemon-reload -sudo systemctl enable crio --now - -echo "CRI runtime installed successfully" - -sudo apt-get update sudo apt-get install -y apt-transport-https ca-certificates curl gpg -curl -fsSL https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg +curl -fsSL https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/Release.key | sudo gpg --no-tty --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v'$VERSION'/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list sudo apt-get update -y diff --git a/cicd/k8s-calico-ipsec-ha/node_scripts/master.sh b/cicd/k8s-calico-ipsec-ha/node_scripts/master.sh index a5cdecaac..d4b836aef 100644 --- a/cicd/k8s-calico-ipsec-ha/node_scripts/master.sh +++ b/cicd/k8s-calico-ipsec-ha/node_scripts/master.sh @@ -6,10 +6,6 @@ set -euxo pipefail NODENAME=$(hostname -s) -sudo kubeadm config images pull - -echo "Preflight Check Passed: Downloaded All Required Images" - #sudo kubeadm init --apiserver-advertise-address=$CONTROL_IP --apiserver-cert-extra-sans=$CONTROL_IP --pod-network-cidr=$POD_CIDR --service-cidr=$SERVICE_CIDR --node-name "$NODENAME" --ignore-preflight-errors Swap sudo kubeadm init --ignore-preflight-errors Swap --config /vagrant/yaml/kubeadm-config.yaml @@ -33,7 +29,8 @@ cp -i /etc/kubernetes/admin.conf $config_path/config touch $config_path/join.sh chmod +x $config_path/join.sh -kubeadm token create --print-join-command > $config_path/join.sh +join_cmd=`kubeadm token create --print-join-command` +echo $join_cmd "--cri-socket /var/run/cri-dockerd.sock" > $config_path/join.sh # Install Calico Network Plugin diff --git a/cicd/k8s-calico-ipsec-ha/yaml/kubeadm-config.yaml b/cicd/k8s-calico-ipsec-ha/yaml/kubeadm-config.yaml index 245a62553..20a7207ac 100644 --- a/cicd/k8s-calico-ipsec-ha/yaml/kubeadm-config.yaml +++ b/cicd/k8s-calico-ipsec-ha/yaml/kubeadm-config.yaml @@ -14,6 +14,7 @@ nodeRegistration: imagePullPolicy: IfNotPresent name: master taints: null + criSocket: unix:///var/run/cri-dockerd.sock --- apiVersion: kubeadm.k8s.io/v1beta3 certificatesDir: /etc/kubernetes/pki @@ -67,3 +68,7 @@ metricsBindAddress: 127.0.0.1:10249 nodePortAddresses: null oomScoreAdj: -999 portRange: "" +--- +kind: KubeletConfiguration +apiVersion: kubelet.config.k8s.io/v1beta1 +cgroupDriver: systemd