thinkingmonster
thinkingmonster

Reputation: 5433

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.

Upvotes: 1

Views: 3754

Answers (3)

Mohammad Ravanbakhsh
Mohammad Ravanbakhsh

Reputation: 3086

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

Upvotes: 1

P Ekambaram
P Ekambaram

Reputation: 17689

try this command

kubectl cluster-info

Upvotes: 0

prashant
prashant

Reputation: 3328

can you try with this command

 kubectl get componentstatus -o jsonpath="{.items[*].conditions[*].status}"

I know both commands are same but outputting it as yaml worked for me

Upvotes: 1

Related Questions