Kubelet安装集成Containerd

  sre


准备:

cat <<EOF |  tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF

 modprobe overlay
 modprobe br_netfilter


设置必需的 sysctl 参数,这些参数在重新启动后仍然存在:

cat <<EOF |  tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

 sysctl --system

安装 Docker 的官方 GPG 密钥

curl -fsSL https://download.docker.com/linux/ubuntu/gpg |  apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -

新增 Docker apt 仓库。

add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

安装containerd包

apt-get update 
apt-get install -y containerd.io

生成containerd默认配置

mkdir -p /etc/containerd
containerd config default > /etc/containerd/config.toml

修改kubelet配置
在配置文件/var/lib/kubelet/kubeadm-flags.envKUBELET_KUBEADM_ARGS追加以下部分

KUBELET_KUBEADM_ARGS="--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock --image-service-endpoint=unix:///run/containerd/containerd.sock"

重启containerd和kubelet服务

systemctl restart containerd kubelet

LEAVE A COMMENT

Captcha Code