部署k8s报错:unknown container “/system.slice/kubelet.service”

部署k8s报错:unknown container “/system.slice/kubelet.service”

*原因:kubernetes和docker版本兼容性问题(有可能是k8s版本太高,docker版本太低的问题)
解决方法:修改kubelet配置文 *



因为我是用kubeadm装的,所以不是这样配置的,通过查看/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
得出结论:
vim /var/lib/kubelet/kubeadm-flags.env
在KUBELET_CGROUP_ARGS=–cgroup-driver=systemd 在后面增加以下内容 --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice

systemctl daemon-reload
systemctl restart kubelet

[root@k8snode01-49 bin]# systemctl status kubelet # 查看运行状态 ● kubelet.service - kubelet: The Kubernetes Node Agent Loaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/kubelet.service.d └─10-kubeadm.conf Active: active (running) since 三 2025-06-25 17:07:03 CST; 7min ago Docs: https://kubernetes.io/docs/ Main PID: 15576 (kubelet) Tasks: 14 Memory: 30.0M CGroup: /system.slice/kubelet.service └─15576 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --contai... 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.611440 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.712048 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.812741 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.913020 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.024133 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.124389 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.224745 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.325352 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.426141 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.526814 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" [root@k8snode01-49 bin]# journalctl -xeu kubelet 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.325352 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.426141 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.526814 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.635436 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.736500 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.837486 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.938137 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.997608 15576 remote_runtime.go:222] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.997657 15576 kuberuntime_sandbox.go:71] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to get 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.997677 15576 kuberuntime_manager.go:772] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to get 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:26.997721 15576 pod_workers.go:965] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-controller-manage 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.039080 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.139677 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.240528 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.340706 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.441376 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.542175 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.642549 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.743424 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.844051 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.944536 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.045155 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.145533 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.245835 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.346226 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.446390 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.547045 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.547045 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.647785 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.748016 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.848328 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.949244 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.031502 15576 kubelet.go:2373] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotRea 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.049821 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.151914 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.253839 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.354434 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.455443 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" [root@k8snode01-49 bin]# systemctl status kubelet # 查看运行状态 ● kubelet.service - kubelet: The Kubernetes Node Agent Loaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/kubelet.service.d └─10-kubeadm.conf Active: active (running) since 三 2025-06-25 17:07:03 CST; 7min ago Docs: https://kubernetes.io/docs/ Main PID: 15576 (kubelet) Tasks: 14 Memory: 30.0M CGroup: /system.slice/kubelet.service └─15576 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --contai... 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.611440 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.712048 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.812741 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:25 k8snode01-49 kubelet[15576]: E0625 17:14:25.913020 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.024133 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.124389 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.224745 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.325352 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.426141 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.526814 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" [root@k8snode01-49 bin]# journalctl -xeu kubelet 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.325352 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.426141 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.526814 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.635436 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.736500 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.837486 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.938137 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.997608 15576 remote_runtime.go:222] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.997657 15576 kuberuntime_sandbox.go:71] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to get 6月 25 17:14:26 k8snode01-49 kubelet[15576]: E0625 17:14:26.997677 15576 kuberuntime_manager.go:772] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to get 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:26.997721 15576 pod_workers.go:965] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-controller-manage 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.039080 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.139677 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.240528 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.340706 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.441376 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.542175 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.642549 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.743424 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.844051 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:27 k8snode01-49 kubelet[15576]: E0625 17:14:27.944536 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.045155 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.145533 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.245835 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.346226 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.446390 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.547045 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.547045 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.647785 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.748016 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.848328 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:28 k8snode01-49 kubelet[15576]: E0625 17:14:28.949244 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.031502 15576 kubelet.go:2373] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotRea 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.049821 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.151914 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.253839 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.354434 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found" 6月 25 17:14:29 k8snode01-49 kubelet[15576]: E0625 17:14:29.455443 15576 kubelet.go:2448] "Error getting node" err="node \"k8snode01-49\" not found"
最新发布
06-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值