1

I have a HA cluster(say 3 masters with 1 kubes-scheduler pod on each master). There is a container running in each kube-scheduler pod. Inside this container, there two problems need to be solved here:

  1. How to know which kube-scheduler pod the container is running on?
  2. How to know if the kube-scheduler this container is running on is a leader?

I know the "holderIdentity" field of the "...kubernetes.io/leader" annotation of the pod will tell the ID of the leader. Then the only question is how to know which pod the container is running on. Or there is a way I can simply know if the pod I'm running is a leader.

Jonas
  • 121,568
  • 97
  • 310
  • 388
JoyceLee
  • 85
  • 3
  • 11

1 Answers1

1

You can check the logs of kube-scheduler. You shall see lock is held by <HolderIdentity> and has not yet expired in the logs of non-leader Pods. And also successfully acquired lease or successfully renewed lease in the leader Pod logs.

wineinlib
  • 480
  • 2
  • 12