k8s使用containerd作为容器运行时

网友投稿 407 2022-09-10

k8s使用containerd作为容器运行时

主机初始化

安装containerd容器运行时

获取阿里云镜像源

$ wget -O /etc/yum.repos.d/docker-ce.repo yum install -y containerd

启动containerd服务

$ systemctl start containerd && systemctl enable containerd

创建containerd配置文件

$ mkdir -p /etc/containerd$ containerd config default > /etc/containerd/config.toml #替换配置文件$ vim /etc/containerd/config.toml #修改配置sandbox_image = "k8s.gcr.io/pause:3.2" #镜像拉取地址endpoint = [" #???[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] #???

修改配置文件

$ sed -i "s#k8s.gcr.io#registry.cn-hangzhou.aliyuncs.com/google_containers#g" /etc/containerd/config.toml$ sed -i '/containerd.runtimes.runc.options/a\ \ \ \ \ \ \ \ \ \ \ \ SystemdCgroup = true' /etc/containerd/config.toml$ sed -i "s# /etc/containerd/config.toml

重启containerd服务

$ systemctl restart containerd

kubeadm初始化k8s集群

设置容器运行时

$ crictl config runtime-endpoint /run/containerd/containerd.sock #master节点操作$ crictl config runtime-endpoint /run/containerd/containerd.sock #node节点操作

初始化集群配置文件

$ kubeadm config print init-defaults > kubeadm.yaml$ vim kubeadm.yamlapiVersion: kubeadm.k8s.io/v1beta3 bootstrapTokens: - groups: - system:bootstrappers:kubeadm:default-node-token token: abcdef.0123456789abcdef ttl: 24h0m0s usages: - signing - authentication kind: InitConfiguration localAPIEndpoint: advertiseAddress: 192.168.2.60 #控制节点的 ip bindPort: 6443 nodeRegistration: criSocket: /run/containerd/containerd.sock #用 containerd 作为容器运行时 imagePullPolicy: IfNotPresent name: master1 #控制节点主机名 taints: null --- apiServer: timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta3 certificatesDir: /etc/kubernetes/pki clusterName: kubernetes controllerManager: {} dns: {} etcd: local: dataDir: /var/lib/etcd imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers #指定镜像仓库地址kind: ClusterConfiguration kubernetesVersion: 1.23.3 #k8s 版本 networking: dnsDomain: cluster.local podSubnet: 10.244.0.0/16 #指定 pod 网段 serviceSubnet: 10.96.0.0/16 #指定 Service 网段 scheduler: {} --- apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration mode: ipvs --- apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration cgroupDriver: systemd

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:不进则已一进就俩,巴坎布打开进球账户谢李可!
下一篇:k8s学习-存储
相关文章

 发表评论

暂时没有评论,来抢沙发吧~