重新启动主节点 - 从单元文件中消失

问题描述

我安装了一个正在运行的主节点并正常工作,但是重新启动服务器(Ubuntu 20.04)却无法启动 kubelet。

我希望能够重启 kubernetes 主节点?

重新启动服务器时出现以下错误

systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
     Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/kubelet.service.d
             └─10-kubeadm.conf
     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-06-02 18:47:22 CEST; 5s ago
       Docs: https://kubernetes.io/docs/home/
    Process: 7677 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONfig_ARGS $KUBELET_CONfig_ARGS $KUBELET_KUBEADM_ARGS $K>
   Main PID: 7677 (code=exited,status=1/FAILURE)

还有 journalctl -u kubelet.service

- Logs begin at Fri 2020-08-07 12:14:59 CEST,end at Wed 2021-06-02 18:45:28 CEST. --
Jun 02 16:57:57 macbook-kubernetes-master systemd[1]: Started kubelet: The Kubernetes Node Agent.
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: kubelet.service: Current command vanished from the unit file,>
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: Stopping kubelet: The Kubernetes Node Agent...
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: kubelet.service: Succeeded.
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: Started kubelet: The Kubernetes Node Agent.
Jun 02 16:57:58 macbook-kubernetes-master kubelet[9405]: E0602 16:57:58.523101    9405 server.go:204] "Failed to lo>
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: kubelet.service: Main process exited,code=exited,status=1/F>
Jun 02 16:57:58 macbook-kubernetes-master systemd[1]: kubelet.service: Failed with result 'exit-code'.
Jun 02 16:58:08 macbook-kubernetes-master systemd[1]: kubelet.service: Scheduled restart job,restart counter is at>
Jun 02 16:58:08 macbook-kubernetes-master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Jun 02 16:58:08 macbook-kubernetes-master systemd[1]: Started kubelet: The Kubernetes Node Agent.
Jun 02 16:58:08 macbook-kubernetes-master kubelet[10091]: E0602 16:58:08.689156   10091 server.go:204] "Failed to l>
Jun 02 16:58:08 macbook-kubernetes-master systemd[1]: kubelet.service: Main process exited,status=1/F>
Jun 02 16:58:08 macbook-kubernetes-master systemd[1]: kubelet.service: Failed with result 'exit-code'.
Jun 02 16:58:18 macbook-kubernetes-master systemd[1]: kubelet.service: Scheduled restart job,restart counter is at>
Jun 02 16:58:18 macbook-kubernetes-master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Jun 02 16:58:18 macbook-kubernetes-master systemd[1]: Started kubelet: The Kubernetes Node Agent.
Jun 02 16:58:18 macbook-kubernetes-master kubelet[10253]: E0602 16:58:18.937758   10253 server.go:204] "Failed to l>
Jun 02 16:58:18 macbook-kubernetes-master systemd[1]: kubelet.service: Main process exited,status=1/F>
Jun 02 16:58:18 macbook-kubernetes-master systemd[1]: kubelet.service: Failed with result 'exit-code'.
Jun 02 16:58:29 macbook-kubernetes-master systemd[1]: kubelet.service: Scheduled restart job,restart counter is at>
Jun 02 16:58:29 macbook-kubernetes-master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Jun 02 16:58:29 macbook-kubernetes-master systemd[1]: Started kubelet: The Kubernetes Node Agent.
Jun 02 16:58:29 macbook-kubernetes-master kubelet[10449]: E0602 16:58:29.362283   10449 server.go:204] "Failed to l>
Jun 02 16:58:29 macbook-kubernetes-master systemd[1]: kubelet.service: Main process exited,status=1/F>
Jun 02 16:58:29 macbook-kubernetes-master systemd[1]: kubelet.service: Failed with result 'exit-code'.
Jun 02 16:58:39 macbook-kubernetes-master systemd[1]: kubelet.service: Scheduled restart job,restart counter is at>
Jun 02 16:58:39 macbook-kubernetes-master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Jun 02 16:58:39 macbook-kubernetes-master systemd[1]: Started kubelet: The Kubernetes Node Agent.

docker ps -a

CONTAINER ID   IMAGE                    COMMAND                  CREATED       STATUS                     PORTS     NAMES
59eeea50f44e   296a6d5035e2             "/coredns -conf /etc…"   2 hours ago   Exited (128) 2 hours ago             k8s_coredns_coredns-558bd4d5db-hxcj2_kube-system_d29df90d-5177-4df5-abca-a057cba1ed42_0
acad7d1e6573   296a6d5035e2             "/coredns -conf /etc…"   2 hours ago   Exited (128) 2 hours ago             k8s_coredns_coredns-558bd4d5db-t4kxv_kube-system_68e152f7-ad57-4b34-9499-b3b45279d241_0
8cf21f7e6fb5   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_coredns-558bd4d5db-hxcj2_kube-system_d29df90d-5177-4df5-abca-a057cba1ed42_0
baf11c38d44c   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_coredns-558bd4d5db-t4kxv_kube-system_68e152f7-ad57-4b34-9499-b3b45279d241_0
90a6e3d81d1d   8522d622299c             "/opt/bin/flanneld -…"   2 hours ago   Exited (128) 2 hours ago             k8s_kube-flannel_kube-flannel-ds-hb697_kube-system_97c5fccf-1cff-4b72-b498-e6e42d723889_0
d0486bfc5b99   quay.io/coreos/flannel   "cp -f /etc/kube-fla…"   2 hours ago   Exited (128) 2 hours ago             k8s_install-cni_kube-flannel-ds-hb697_kube-system_97c5fccf-1cff-4b72-b498-e6e42d723889_0
531c6e64fd9a   4359e752b596             "/usr/local/bin/kube…"   2 hours ago   Exited (2) 2 hours ago               k8s_kube-proxy_kube-proxy-xlk5h_kube-system_cbe752db-73a7-467f-af98-4e46c5895b24_0
7e3b00e40f1f   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_kube-proxy-xlk5h_kube-system_cbe752db-73a7-467f-af98-4e46c5895b24_0
19b597de6e3e   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_kube-flannel-ds-hb697_kube-system_97c5fccf-1cff-4b72-b498-e6e42d723889_0
7dcef1ffa7ae   0369cf4303ff             "etcd --advertise-cl…"   2 hours ago   Exited (128) 2 hours ago             k8s_etcd_etcd-macbook-kubernetes-master_kube-system_9c237205cc95fdecd0d549ad1206ddbd_0
2a6db203404b   a4183b88f6e6             "kube-scheduler --au…"   2 hours ago   Exited (2) 2 hours ago               k8s_kube-scheduler_kube-scheduler-macbook-kubernetes-master_kube-system_5e2aa19b98f65a7e7221ad34a37553f6_0
64e1757daaf8   771ffcf9ca63             "kube-apiserver --ad…"   2 hours ago   Exited (128) 2 hours ago             k8s_kube-apiserver_kube-apiserver-macbook-kubernetes-master_kube-system_9f889f482105c6afa042e734a02d2fe1_0
18fa9d660b6c   e16544fd47b0             "kube-controller-man…"   2 hours ago   Exited (2) 2 hours ago               k8s_kube-controller-manager_kube-controller-manager-macbook-kubernetes-master_kube-system_f122bb88c43af8d2f37fa35cb230b918_0
4a238c2f9440   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_kube-apiserver-macbook-kubernetes-master_kube-system_9f889f482105c6afa042e734a02d2fe1_0
ba34f50ccb96   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_etcd-macbook-kubernetes-master_kube-system_9c237205cc95fdecd0d549ad1206ddbd_0
6519ed692628   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_kube-scheduler-macbook-kubernetes-master_kube-system_5e2aa19b98f65a7e7221ad34a37553f6_0
be460c39d3bb   k8s.gcr.io/pause:3.4.1   "/pause"                 2 hours ago   Exited (128) 2 hours ago             k8s_POD_kube-controller-manager-macbook-kubernetes-master_kube-system_f122bb88c43af8d2f37fa35cb230b918_0

然后我尝试了(之后;sudo addgroup --system docker,sudo adduser $USER docker,newgrp docker )

sudo docker restart $(docker ps -a -q)

Error response from daemon: Cannot restart container 59eeea50f44e: cannot join network of a non running container: 8cf21f7e6fb554b44aa563f981181705b37eb5b7066ea1caf5ee2cb1001c2712
Error response from daemon: Cannot restart container acad7d1e6573: cannot join network of a non running container: baf11c38d44c77b08ce7b4d61bef4af5adf44df19d4cd8883e9e4f1d4064ef8f
Error response from daemon: Cannot restart container 8cf21f7e6fb5: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/podd29df90d-5177-4df5-abca-a057cba1ed42': unkNown
Error response from daemon: Cannot restart container baf11c38d44c: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/pod68e152f7-ad57-4b34-9499-b3b45279d241': unkNown
Error response from daemon: Cannot restart container 90a6e3d81d1d: cannot join network of a non running container: 19b597de6e3e32db8d0058a4a6bb76a92cd7d207fdd247b7e24d82a6abff49e4
Error response from daemon: Cannot restart container d0486bfc5b99: cannot join network of a non running container: 19b597de6e3e32db8d0058a4a6bb76a92cd7d207fdd247b7e24d82a6abff49e4
Error response from daemon: Cannot restart container 531c6e64fd9a: cannot join network of a non running container: 7e3b00e40f1fdf07e9924e10b332bc0529da160a4f277b359b437b313d159111
Error response from daemon: Cannot restart container 7e3b00e40f1f: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/besteffort/podcbe752db-73a7-467f-af98-4e46c5895b24': unkNown
Error response from daemon: Cannot restart container 19b597de6e3e: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/pod97c5fccf-1cff-4b72-b498-e6e42d723889': unkNown
Error response from daemon: Cannot restart container 7dcef1ffa7ae: cannot join network of a non running container: ba34f50ccb96a26a518e8c6db53bc647a7a8ef4abb0bbd541f4fe3a3296b6e16
Error response from daemon: Cannot restart container 2a6db203404b: cannot join network of a non running container: 6519ed692628d2ff9fcb99cda92106c70e2817f79353957d697100bc98de76f0
Error response from daemon: Cannot restart container 64e1757daaf8: cannot join network of a non running container: 4a238c2f94400831653dc7a6b347d2350753f90c24e9b4b25cd2ccb18c6e804e
Error response from daemon: Cannot restart container 18fa9d660b6c: cannot join network of a non running container: be460c39d3bbba81484c9297841963f644f84511d92adf8e77016296a64f9513
Error response from daemon: Cannot restart container 4a238c2f9440: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/pod9f889f482105c6afa042e734a02d2fe1': unkNown
Error response from daemon: Cannot restart container ba34f50ccb96: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/pod9c237205cc95fdecd0d549ad1206ddbd': unkNown
Error response from daemon: Cannot restart container 6519ed692628: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/pod5e2aa19b98f65a7e7221ad34a37553f6': unkNown
Error response from daemon: Cannot restart container be460c39d3bb: OCI runtime create Failed: container_linux.go:367: starting container process caused: process_linux.go:340: applying cgroup configuration for process caused: Invalid unit name '/kubepods/burstable/podf122bb88c43af8d2f37fa35cb230b918': unkNown

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)