Kubernetes version: 1.19.2
Cloud being used: AWA
Installation method: kubeadm
Host OS: linux
CNI and version:
CRI and version:
It is a new installed cluster with one master and one node, kubectl get nodes returns ready, kubelctl get po get all running status, but kubectl get cs returns unhealthy for scheduler and controller-manager:
ubuntu@ip-10-0-0-42:~/kubeadm/single$ 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”}
I know cs will be deprecated soon, but is this unhealthy status a problem, if I need to fix it and how to fix it?
Thank you
Solution:
Modify the following files on all master nodes:
$ sudo vi /etc/kubernetes/manifests/kube-scheduler.yaml
Clear the line (spec->containers->command) containing this phrase: - --port=0
$ sudo vi /etc/kubernetes/manifests/kube-controller-manager.yaml
Clear the line (spec->containers->command) containing this phrase: - --port=0
$ sudo systemctl restart kubelet.service
Another reason for this problem:
You may have used http_proxy in the docker setting. In this case, you must set address of the master nodes addresses in no_proxy
I did your commands and that fixed it but I am using containerD.
Do you know where this setting would be if I was using KubeSpray for the deployment?
I modify the config but it’s not working. Should I upgrade my Kubernetes ? Does it affect anything if I upgrade it?
I changed the secure-port
to 10252 and bind-address
to host real ip. Are there any parameters that can change the address and port for health checks? Like this:
# kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Unhealthy Get "https://192.168.0.129:10252/healthz": dial tcp 192.168.0.129:10252: connect: connection refused
controller-manager Unhealthy Get "https://192.168.0.129:10253/healthz": dial tcp 192.168.0.129:10252: connect: connection refused
etcd-0 Healthy {"health":"true","reason":""}
etcd-2 Healthy {"health":"true","reason":""}
etcd-1 Healthy {"health":"true","reason":""}