k8s服务器重启后执行kubectl get nodes报错

网友投稿 387 2022-09-11

k8s服务器重启后执行kubectl get nodes报错

[root@vm ~]# kubectl get nodes

The connection to the server localhost:8080 was refused - did you specify the right host or port?

此时查看docker ps 容器都是未启动状态

[root@vm ~]# docker ps

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

[root@vm~]# docker ps  -a

CONTAINER ID   IMAGE                                               COMMAND                  CREATED        STATUS                      PORTS     NAMES

4338ee976acd   49130a5a0755                                        "/bin/prometheus --w…"   21 hours ago   Exited (0) 21 hours ago               k8s_prometheus_prometheus-cluster-monitoring-0_cattle-prometheus_474ca29f-980f-4dc6-b5f9-c24183329900_1

dbec4bb12fa1   62714087d2f0                                        "prometheus-auth --p…"   21 hours ago   Exited (2) 21 hours ago               k8s_prometheus-agent_prometheus-cluster-monitoring-0_cattle-prometheus_474ca29f-980f-4dc6-b5f9-c24183329900_0

e5ca428d0b28   6f715d38cfe0                                        "/bin/sh -c 'cp /ngi…"   21 hours ago   Exited (0) 21 hours ago               k8s_prometheus-proxy_prometheus-cluster-monitoring-0_cattle-prometheus_474ca29f-980f-4dc6-b5f9-c24183329900_0

557bbb566022   rancher/jimmidyson-configmap-reload                 "/configmap-reload -…"   21 hours ago   Exited (2) 21 hours ago               k8s_rules-configmap-reloader_prometheus-cluster-monitoring-0_cattle-prometheus_474ca29f-980f-4dc6-b5f9-c24183329900_0

2e5fde701c05   rancher/library-nginx                               "/docker-entrypoint.…"   21 hours ago   Exited (0) 21 hours ago               k8s_grafana-proxy_grafana-cluster-monitoring-575d64fcf-97t5k_cattle-prometheus_d9c4e1bc-a1fa-4dee-9b6c-e0db9cb165c1_0

解决步骤是:

systemctl restart kubelet  #重启服务

systemctl restart docker   #docker视情况重启

[root@vm ~]#  systemctl restart kubelet

[root@vm ~]# kubectl get pods -A

NAMESPACE           NAME                                                       READY   STATUS    RESTARTS   AGE

cattle-prometheus   exporter-kube-state-cluster-monitoring-79c667fdc9-qq5k7    1/1     Running   0          21h

cattle-prometheus   exporter-node-cluster-monitoring-cs7lk                     1/1     Running   0          21h

cattle-prometheus   exporter-node-cluster-monitoring-v48j9                     1/1     Running   0          21h

cattle-prometheus   grafana-cluster-monitoring-575d64fcf-97t5k                 2/2     Running   0          21h

cattle-prometheus   prometheus-cluster-monitoring-0                            5/5     Running   1          21h

cattle-prometheus   prometheus-operator-monitoring-operator-6dd84ddd49-8jzxg   1/1     Running   0          21h

cattle-system       cattle-cluster-agent-866cfc89fc-42qng                      1/1     Running   0          21h

fleet-system        fleet-agent-55bfc495bd-9csrw                               1/1     Running   0          21h

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

上一篇:k8s源码学习 client-go源码结构和客户端对象
下一篇:jenkins+kubernetes(k8s)+docker持续集成与部署(CI/CD) - k8s系列(二)
相关文章

 发表评论

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