How to detect the active Controller Manager and Scheduler in a Kubernetes HA Master setup?

8/24/2017

I've set a kubernetes cluster with master in high availability: 3 etcd nodes, 3 apiservers, 3 controller managers and 3 schedulers. There is a load balancer in front of the api servers. I see apiservers running as Active-Active while Controller Manager and Scheduler are working as Active/Standby. Does anyone know how to detect the active Controller Manager and Scheduler in a HA Master setup?

All the K8s infra components are managed by systemd not by dockerd.

Thanks.

-- kalise
high-availability
kubernetes

2 Answers

8/25/2017

In my case, retrieving the endpoints yaml and looking in the "holderIdentity" field of the "...kubernetes.io/leader" annotation.

-- rod
Source: StackOverflow

7/26/2018

I use below commands to find out the leader

kubectl proxy --port=8000

curl 127.0.0.1:8000/api/v1/namespaces/kube-system/endpoints/kube-controller-manager | grep leader

curl 127.0.0.1:8000/api/v1/namespaces/kube-system/endpoints/kube-scheduler | grep leader
-- P Ekambaram
Source: StackOverflow