HA kubernetes 集群健康命令

HA kubernetes 集群健康命令

我想知道是否有可能看到多主部署中哪个组件是主要服务(调度程序、控制器管理器等)。

有什么命令可以显示该信息吗?

提前致谢。

答案1

您可以检索端点 yaml 并查看注释holderIdentity的字段...kubernetes.io/leader

来自我的集群的示例:

~$ kubectl -n kube-system get ep kube-scheduler -o yaml

apiVersion: v1
kind: Endpoints
metadata:
  annotations:
    control-plane.alpha.kubernetes.io/leader: '{"holderIdentity":"cluster-0_9e8c557b-8dc4-11e9-90d3-42010a9c000a","leaseDurationSeconds":15,"acquireTime":"2019-06-13T10:19:10Z","renewTime":"2019-06-13T11:19:20Z","leaderTransitions":19}'
  creationTimestamp: "2019-03-26T13:04:45Z"
  name: kube-scheduler
  namespace: kube-system
  resourceVersion: "923505"
  selfLink: /api/v1/namespaces/kube-system/endpoints/kube-scheduler
  uid: ba115d1b-4fc7-11e9-b783-42010a9c000a

相关内容