故障现象 查看状态存在不健康组件
代码语言:javascript
复制[root@k8s-master ~]#kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19
NAME STATUS MESSAGE ERROR
scheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused
controller-manager Unhealthy Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10252: connect: connection refused
etcd-0 Healthy {"health":"true"}
解决办法
代码语言:javascript
复制[root@k8s-master ~]#cd /etc/kubernetes/manifests/
[root@k8s-master /etc/kubernetes/manifests]#ls
etcd.yaml kube-apiserver.yaml kube-controller-manager.yaml kube-scheduler.yaml
将两个配置文件的- --port=0前边加上#号注释掉
[root@k8s-master /etc/kubernetes/manifests]#vim kube-controller-manager.yaml
[root@k8s-master /etc/kubernetes/manifests]#vim kube-scheduler.yaml
重启kubelet服务
代码语言:javascript
复制[root@k8s-master /etc/kubernetes/manifests]#systemctl restart kubelet.service
再次查看cs状态
代码语言:javascript
复制[root@k8s-master /etc/kubernetes/manifests]#kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health":"true"}