How to force leader transition in a Kubernetes Cluster

4/20/2018

I have a 2 Node HA kubernetes HA Cluster, setup using kubeadm. I'm trying to determine if there is a way to force a leader transition between the two master nodes without rebooting the current Master node? Any pointers will be very helpful

This is the current status of my kube-schedulers and controller managers

[root@controller-0 ~]# kubectl describe endpoints kube-scheduler  -n kube-system
Name:         kube-scheduler
Namespace:    kube-system
Labels:       <none>
Annotations:  control-plane.alpha.kubernetes.io/leader={"holderIdentity":"controller-0_3b7e7b10-426f-11e8-8bd4-080027c7f746","leaseDurationSeconds":15,"acquireTime":"2018-04-17T18:43:39Z","renewTime":"2018-04-17T19...
Subsets:
Events:
  Type    Reason          Age   From               Message
  ----    ------          ----  ----               -------
  Normal  LeaderElection  23m   default-scheduler  controller-0_3b7e7b10-426f-11e8-8bd4-080027c7f746 became leader

[root@controller-0 ~]# kubectl get endpoints kube-controller-manager --namespace=kube-system  -o yaml
apiVersion: v1
kind: Endpoints
metadata:
  annotations:
    control-plane.alpha.kubernetes.io/leader: '{"holderIdentity":"controller-0_3e493110-426f-11e8-a597-080027c7f746","leaseDurationSeconds":15,"acquireTime":"2018-04-17T18:43:38Z","renewTime":"2018-04-17T19:03:18Z","leaderTransitions":0}'
  creationTimestamp: 2018-04-17T18:43:38Z
  name: kube-controller-manager
  namespace: kube-system
  resourceVersion: "2348"
  selfLink: /api/v1/namespaces/kube-system/endpoints/kube-controller-manager
  uid: 3e4b4b33-426f-11e8-ac0a-080027c7f746
-- Shoaib Ahmed Nasir
kubeadm
kubernetes

0 Answers