Kubernetes: how do you list components running on master?

1/16/2020

How do you list components running on the master Kubernetes node?

I assume there should be a kubeadm or kubectl command but can't find anything.

E.g. I'm looking to see if the Scheduler is running and I've used kubeadm config view which lists:

scheduler: {}

but not sure if that means the Scheduler is not running or there's simply no config for it.

-- Snowcrash
kubernetes

2 Answers

1/16/2020

Assuming that you want to check what is running in master node and you are unable not do that via Kubernetes API server.

For kubelet since its running as systemd service you can check systemctl status kubelet.service.

Other components such as scheduler is run as container by kubelet so you can check them with standard docker command such as docker ps.

-- Arghya Sadhu
Source: StackOverflow

1/16/2020

Since you have installed with kubeadm, the control plane components must be running as pods in kube-system namespace. So you can run the following command to see if scheduler is running.

#  kubectl get pod -n kube-system
NAME                                               READY   STATUS    RESTARTS   AGE
calico-node-4x9fp                                  2/2     Running   0          4d6h
coredns-86c58d9df4-bw2q9                           1/1     Running   0          4d6h
coredns-86c58d9df4-gvcl9                           1/1     Running   0          4d6h
etcd-k1                                            1/1     Running   0          4d6h
kube-apiserver-k1                                  1/1     Running   0          4d6h
kube-controller-manager-k1                         1/1     Running   83         4d6h
kube-dash-kubernetes-dashboard-5b7cf769bc-pd2n2    1/1     Running   0          4d6h
kube-proxy-jmrrz                                   1/1     Running   0          4d6h
kube-scheduler-k1                                  1/1     Running   82         4d6h
metrics-server-8544b5c78b-k2lwt                    1/1     Running   16         4d6h
tiller-deploy-5f4fc5bcc6-gvhlz                     1/1     Running   0          4d6h

If you want to know all pods running on a master node(or any particular node), you can use field-selector to select the node.

kubectl get pod --all-namespaces --field-selector  spec.nodeName=<nodeName>

To filter pods only in kube-system namespace running on particular node -

kubectl get pod -n kube-system --field-selector  spec.nodeName=<nodeName>
-- Shashank V
Source: StackOverflow