From e33af15d2d632414eba6db78d326d851ef46b4bc Mon Sep 17 00:00:00 2001 From: lixiaoyuner <35456895+lixiaoyuner@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:21:37 +0800 Subject: [PATCH] Install kubernetes-cni for kubelet (#14163) Why I did it Find a new bug on kubelet side. The kubernetes-cni plug-in was removed in #12997, the reason is that the plug-in will be auto installed when install kubeadm, and will report error if we don't remove the install code. But after removal, the version auto installed is different from what we installed before. This will affect the kubelet action in some scenarios we don't find before. Need to install it by another way. How I did it Install kubernetes-cni==0.8.7-00 before install kubeadm How to verify it Flannel binary will be installed under /opt/cni/bin/ folder --- Makefile.work | 1 + build_debian.sh | 1 + rules/config | 1 + 3 files changed, 3 insertions(+) diff --git a/Makefile.work b/Makefile.work index 04ffc7c5ab..d51d5f5bfb 100644 --- a/Makefile.work +++ b/Makefile.work @@ -463,6 +463,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ INCLUDE_KUBERNETES=$(INCLUDE_KUBERNETES) \ KUBERNETES_VERSION=$(KUBERNETES_VERSION) \ + KUBERNETES_CNI_VERSION=$(KUBERNETES_CNI_VERSION) \ K8s_GCR_IO_PAUSE_VERSION=$(K8s_GCR_IO_PAUSE_VERSION) \ INCLUDE_KUBERNETES_MASTER=$(INCLUDE_KUBERNETES_MASTER) \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ diff --git a/build_debian.sh b/build_debian.sh index f296c6fe1d..c0d90bdfad 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -262,6 +262,7 @@ install_kubernetes () { ## Check out the sources list update matches current Debian version sudo cp files/image_config/kubernetes/kubernetes.list $FILESYSTEM_ROOT/etc/apt/sources.list.d/ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update + sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubernetes-cni=${KUBERNETES_CNI_VERSION} sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubelet=${ver} sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubectl=${ver} sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubeadm=${ver} diff --git a/rules/config b/rules/config index b0dd9833f4..9b214d582d 100644 --- a/rules/config +++ b/rules/config @@ -185,6 +185,7 @@ KUBE_DOCKER_PROXY = http://172.16.1.1:3128/ # NOTE: As a worker node it has to run version compatible to kubernetes master. # KUBERNETES_VERSION = 1.22.2-00 +KUBERNETES_CNI_VERSION = 0.8.7-00 K8s_GCR_IO_PAUSE_VERSION = 3.5 # INCLUDE_KUBERNETES_MASTER - if set to y kubernetes packages are installed o be able