-->

DEVOPSZONES

  • Recent blogs

    How to resolve scheduler unhealthy state in Kubernetes , Error: http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused

    How to resolve scheduler  unhealthy state in 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:


    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
    etcd-0               Healthy     {"health":"true","reason":""}
    controller-manager   Healthy     ok
    root@k8s-master:~#


    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 systemctl restart kubelet.service

    root@k8s-master:~# vi /etc/kubernetes/manifests/kube-scheduler.yaml
    root@k8s-master:~# systemctl restart kubelet.service
    root@k8s-master:~# kubectl get cs
    Warning: v1 ComponentStatus is deprecated in v1.19+
    NAME                 STATUS    MESSAGE                         ERROR
    controller-manager   Healthy   ok
    etcd-0               Healthy   {"health":"true","reason":""}
    scheduler            Healthy   ok
    root@k8s-master:~#

    No comments