Search code examples
kuberneteskubectl

How to check health of kubernetes cluster


I know that i can use kubectl get componentstatus command to check the health status of the k8 cluster but some how the output i am receiving do not show the health. Below is the output from master server.

enter image description here

I can do deployments, can create pods and services which means everything is working fine but not sure how to check the health status.


Solution

  • Solved in kube-apiserver v1.17.0, also you should use command below in your older apiserver.

    kubectl get cs -o=go-template='{{printf "NAME\t\t\tHEALTH_STATUS\tMESSAGE\t\n"}}{{range .items}}{{$name := .metadata.name}}{{range .conditions}}{{printf "%-24s%-16s%-20s\n" $name .status .message}}{{end}}{{end}}'
    

    enjoy