How to check if Kubernetes cluster is running fine

2/4/2019

I have a Kubernetes cluster running. I used:

kubeadm init --apiserver-advertise-address=192.168.20.101 --pod-network-cidr=10.244.0.0/16

This is working okay. Now I'm putting this in a script and I only want to execute kubeadm init again if my cluster is not running fine. How can I check if a Kubernetes cluster is running fine? So if not I can recreate the cluster.

-- mealesbia
kubernetes

3 Answers

2/4/2019

You can use the following command to do that:

[root@ip-10-0-1-19]# kubectl cluster-info
Kubernetes master is running at https://10.0.1.197:6443
KubeDNS is running at https://10.0.1.197:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

It shows that your master is running fine on particular url.

-- Prafull Ladha
Source: StackOverflow

2/4/2019

kubectl get cs

The above command would display the health of controller, scheduler and etcd as Healthy if your cluster is fine

# kubectl get cs
NAME                 STATUS    MESSAGE             ERROR
controller-manager   Healthy   ok
scheduler            Healthy   ok
etcd-0               Healthy   {"health":"true"}
-- P Ekambaram
Source: StackOverflow

2/5/2019

You should also check nodes running in the cluster.

kubectl get nodes
-- prisar
Source: StackOverflow