Containerd 错误报错解决Failed to start containerd container runtime.

当安装Containerd,在重启Containerd时出现 

Job for containerd.service failed because the control process exited with error code. See "systemctl status containerd.service" and "journalctl -xe" for details.

根据提示查询Containerd状态

systemctl status containerd.service发现是无法启动容器运行时

[root@master ~]# systemctl restart containerd
Job for containerd.service failed because the control process exited with error code. See "systemctl status containerd.service" and "journalctl -xe" for details.
[root@master ~]# systemctl status containerd.service
● containerd.service - containerd container runtime
   Loaded: loaded (/etc/systemd/system/containerd.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since 日 2022-07-31 13:49:38 CST; 2s ago
     Docs: https://containerd.io
  Process: 5531 ExecStart=/usr/local/bin/containerd (code=exited, status=1/FAILURE)
  Process: 5529 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 5531 (code=exited, status=1/FAILURE)

7月 31 13:49:38 master systemd[1]: containerd.service: main process exited, code=exited, status=1/FAILURE
7月 31 13:49:38 master systemd[1]: Failed to start containerd container runtime.
7月 31 13:49:38 master systemd[1]: Unit containerd.service entered failed state.
7月 31 13:49:38 master systemd[1]: containerd.service failed.

journalctl -xe查看具体原因如下

Unit containerd.service has begun starting up.
7月 31 14:17:20 master containerd[8619]: containerd: Near line 0 (last key parsed ''): bare keys cannot contain '.'
7月 31 14:17:20 master systemd[1]: containerd.service: main process exited, code=exited, status=1/FAILURE
7月 31 14:17:20 master systemd[1]: Failed to start containerd container runtime.
-- Subject: Unit containerd.service has failed

排查发现是Containerd启动时配置文件的问题

解决方案,删除以前的Containerd配置文件,重新执行一下Containerd的安装过程

具体看文章

kubeadm部署指定版本的K8s+containerd+docker——图文详细版(上)

移除以前的配置文件

rm -rf /etc/containerd

重新执行文章中的安装部分

sudo tar -C / -xzf cri-containerd-cni-1.4.3-linux-amd64.tar.gz
export PATH=$PATH:/usr/local/bin:/usr/local/sbin
source ~/.bashrc
mkdir /etc/containerd
containerd config default > /etc/containerd/config.toml

镜像加速的配置就在 cri 插件配置块下面的 registry 配置块

修改镜像

vim /etc/containerd/config.toml

修改为如下配置文件格式

[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
    endpoint = ["https://dockerhub.mirrors.nwafu.edu.cn"]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."k8s.gcr.io"]
    endpoint = ["https://registry.aliyuncs.com/k8sxio"]

保存并退出

启动Containerd,并查询状态

systemctl daemon-reload
systemctl enable containerd
systemctl restart containerd
systemctl status containerd

本文执行该操作过程如下: 

[root@master ~]# rm -rf /etc/containerd
[root@master ~]# ll
总用量 96864
-rw-------. 1 root root     1758 7月  31 09:17 anaconda-ks.cfg
-rw-r--r--. 1 root root 99176835 12月  8 2021 cri-containerd-cni-1.4.3-linux-amd64.tar.gz
-rw-r--r--. 1 root root     1806 7月  31 09:25 initial-setup-ks.cfg
drwxr-xr-x. 2 root root        6 7月  31 09:26 公共
drwxr-xr-x. 2 root root        6 7月  31 09:26 模板
drwxr-xr-x. 2 root root        6 7月  31 09:26 视频
drwxr-xr-x. 2 root root        6 7月  31 09:26 图片
drwxr-xr-x. 2 root root        6 7月  31 09:26 文档
drwxr-xr-x. 2 root root        6 7月  31 09:26 下载
drwxr-xr-x. 2 root root        6 7月  31 09:26 音乐
drwxr-xr-x. 2 root root        6 7月  31 09:26 桌面
[root@master ~]# sudo tar -C / -xzf cri-containerd-cni-1.4.3-linux-amd64.tar.gz
[root@master ~]# export PATH=$PATH:/usr/local/bin:/usr/local/sbin
[root@master ~]# source ~/.bashrc
[root@master ~]# ctr version
Client:
  Version:  v1.4.3
  Revision: 269548fa27e0089a8b8278fc4fc781d7f65a939b
  Go version: go1.15.5

Server:
  Version:  v1.4.3
  Revision: 269548fa27e0089a8b8278fc4fc781d7f65a939b
  UUID: e4c49cb6-919e-4093-b787-e6835710f1a0
[root@master ~]# containerd config default > /etc/containerd/config.toml
-bash: /etc/containerd/config.toml: 没有那个文件或目录
[root@master ~]# mkdir /etc/containerd
[root@master ~]# containerd config default > /etc/containerd/config.toml
[root@master ~]# vim /etc/containerd/config.toml
[root@master ~]# systemctl daemon-reload
[root@master ~]# systemctl enable containerd
Created symlink from /etc/systemd/system/multi-user.target.wants/containerd.service to /etc/systemd/system/containerd.service.
[root@master ~]# systemctl restart containerd
[root@master ~]# systemctl status containerd
● containerd.service - containerd container runtime
   Loaded: loaded (/etc/systemd/system/containerd.service; enabled; vendor preset: disabled)
   Active: active (running) since 日 2022-07-31 14:20:03 CST; 9s ago
     Docs: https://containerd.io
  Process: 8737 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 8740 (containerd)
    Tasks: 8
   Memory: 26.1M
   CGroup: /system.slice/containerd.service
           └─8740 /usr/local/bin/containerd

7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.916462356+08:00" level=info msg=serving... addres....ttrpc
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.916489762+08:00" level=info msg=serving... addres...d.sock
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.916524027+08:00" level=info msg="containerd succe...8398s"
7月 31 14:20:03 master systemd[1]: Started containerd container runtime.
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.926063256+08:00" level=info msg="Start subscribin...event"
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.926129974+08:00" level=info msg="Start recovering state"
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.926210412+08:00" level=info msg="Start event monitor"
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.926218400+08:00" level=info msg="Start snapshots syncer"
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.926225195+08:00" level=info msg="Start cni networ...yncer"
7月 31 14:20:03 master containerd[8740]: time="2022-07-31T14:20:03.926229330+08:00" level=info msg="Start streaming server"
Hint: Some lines were ellipsized, use -l to show in full.

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
It seems like you're encountering an issue with starting the CRI (Container Runtime Interface) interface for the Docker Application Container Engine. This interface is responsible for communication between the container runtime and the Kubernetes control plane. To troubleshoot this issue, you can try the following steps: 1. Check the Docker service status: ``` systemctl status docker ``` This command will show the current status of the Docker service. If it's not running, you can start it using: ``` systemctl start docker ``` 2. Verify that the CRI interface is enabled in Docker's configuration file: Open the Docker daemon configuration file, usually located at `/etc/docker/daemon.json`, and ensure that it contains the following configuration: ```json { "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ] } ``` Save the changes and restart the Docker service. 3. Check if there are any conflicting container runtimes: Run the following command to list all active container runtimes: ``` crictl --runtime-endpoint /var/run/dockershim.sock info ``` If there are any other container runtimes listed, you may need to disable or remove them to avoid conflicts with Docker. 4. Restart the kubelet service: ``` systemctl restart kubelet ``` If none of the above steps resolve the issue, please provide more details about your environment, including the operating system, Docker version, and any relevant error messages, so that I can assist you further.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

QwQ一叶

你的打赏是我制作教程最大的鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值