Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve scheduler and controller-manager unhealthy state in Kubernetes [closed]

Tags:

kubernetes

Symptom:

When we install the new kubernetes cluster. When we execute the following command:

$ kubectl get cs / kubectl get componentstatuses

we get this error:

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"}
like image 353
Mohammad Shafiee Avatar asked Oct 10 '20 17:10

Mohammad Shafiee


1 Answers

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

like image 53
Mohammad Shafiee Avatar answered Sep 19 '22 19:09

Mohammad Shafiee