Kubernetes集群如何查看scheduler/controller manager谁是leader
方法一
-
查看kube-system中的endpoints
<root@PROD-K8S-CP1 ~># kubectl get endpoints -n kube-system NAME ENDPOINTS AGE cilium-agent 10.1.0.10:9095,10.1.0.11:9095,10.1.0.12:9095 + 24 more... 85d csi-provisioner 10.1.0.11:12345 108d kube-controller-manager <none> 111d kube-dns 172.21.2.227:53,172.21.3.26:53,172.21.2.227:9153 + 3 more... 111d kube-dns-tcp 172.21.2.227:53,172.21.3.26:53 82d kube-dns-udp 172.21.2.227:53,172.21.3.26:53 82d kube-scheduler <none> 111d metrics-server 172.21.3.136:443 101d
- 查看具体的kube-scheduler kube-controller-manager具体的属性
<root@PROD-K8S-CP1 ~># kubectl describe endpoints -n kube-system kube-scheduler Name: kube-scheduler Namespace: kube-system Labels: <none> Annotations: control-plane.alpha.kubernetes.io/leader: {"holderIdentity":"PROD-K8S-CP1_8759bfa1-1c6e-4e16-b87f-dce5fae0d4f3","leaseDurationSeconds":15,"acquireTime":"2021-09-12T15:13:03Z","rene... Subsets: Events: <none>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<root@PROD-K8S-CP1 ~># kubectl describe endpoints -n kube-system kube-controller-manager Name: kube-controller-manager Namespace: kube-system Labels: <none> Annotations: control-plane.alpha.kubernetes.io/leader: {"holderIdentity":"PROD-K8S-CP2_02a9a213-0f0a-47c3-8407-d576de8b66e3","leaseDurationSeconds":15,"acquireTime":"2021-09-12T15:01:45Z","rene... Subsets: Events: <none>
方法二
-
查看kube-system中的leases资源,
<root@PROD-K8S-CP1 ~># kubectl get leases -n kube-system NAME HOLDER AGE cilium-operator-resource-lock PROD-SYS-K8S-WN1-kqjJbDPMxJ 111d diskplugin-csi-alibabacloud-com PROD-SYS-K8S-WN3 108d external-attacher-leader-diskplugin-csi-alibabacloud-com PROD-SYS-K8S-WN3 108d external-resizer-diskplugin-csi-alibabacloud-com PROD-SYS-K8S-WN3 108d kube-controller-manager PROD-K8S-CP2_02a9a213-0f0a-47c3-8407-d576de8b66e3 111d kube-scheduler PROD-K8S-CP1_8759bfa1-1c6e-4e16-b87f-dce5fae0d4f3 111d
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步