问题描述
#kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME STATUS MESSAGE ERROR
controller-manager Unhealthy Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10252: connect: connection refused
scheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused
etcd-0 Healthy {"health":"true"}
问题解决
#组件监测异常,只是监测的端口错误,默认监测10251/10252实际监听的不是这个导致,在有些版本会出现类似的问题,不过不影响集群的正常,显示让人很不爽
#/etc/kubernetes/manifests
[root@localhost kubernetes]# cd manifests/ //static pod
[root@localhost manifests]# ll
-rw------- 1 root root 2149 Dec 11 19:47 etcd.yaml
-rw------- 1 root root 3181 Dec 11 19:47 kube-apiserver.yaml
-rw------- 1 root root 2857 Dec 11 19:47 kube-controller-manager.yaml //注释 --port=0
-rw------- 1 root root 1413 Dec 11 19:47 kube-scheduler.yaml //注释 --port=0
[root@localhost manifests]#
# - --port=0
#重启kubelet服务,如果集群运行很久不建议重启kubelet服务,可以对kube-controller-manager、kube-scheduler的deployment重启
systemctl restart kubelet.service
[root@c8-100-30 ~]# kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health":"true"}