Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
yum install -y yum-utils device-mapper-persistent-data lvm2 containerd
containerd config default > /etc/containerd/config.toml
sed -i s#'registry.k8s.io'#'registry.cn-hangzhou.aliyuncs.com/google_containers'#g /etc/containerd/config.toml
sed -i s#'SystemdCgroup = false'#'SystemdCgroup = true'#g /etc/containerd/config.toml
sed -i '/mirrors/ {
    a \ \ \ \ \ \ \ \ [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
    a \ \ \ \ \ \ \ \ \ \ endpoint = ["http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com"]
}' /etc/containerd/config.toml
echo 'KUBELET_EXTRA_ARGS="--container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock"' >>/etc/sysconfig/kubelet

启动kubelt启动kubelt,这中间kubelet可能会重启几次,耐心等待

Code Block
systemctl daemon-reload 
systemctl enable --now containerd && systemctl status containerd
systemctl restart kubelet && systemctl status kubelet

可通过如下命令查看集群状态

Code Block
kubectl get events --all-namespaces --sort-by='.metadata.creationTimestamp'


安装相关容器工具

crictl是k8s默认工具

Code Block
echo 'runtime-endpoint: unix:///var/run/containerd/containerd.sock
image-endpoint: unix:///var/run/containerd/containerd.sock
debug: false
pull-image-on-create: false
disable-pull-on-run: false' >/etc/crictl.yaml
crictl pods
crictl pods --name kube-proxy-dnljx
crictl images



但是习惯docker命令的建议可以使用nerdctl

...