K8S基本操作-31-如何檢查Cluster採用的ETCD的IP or URL ?
如何檢查Cluster採用的ETCD的IP or URL ?
由於 Kube-API server,記錄著這類的訊息,所以可以調出 Pod 訊息查看 ETCD 的位置。
kubectl -n kube-system describe pod <Kube-API Server 的 Pod 名稱>
結果類似下方:
Name: kube-apiserver-cluster2-controlplane
Namespace: kube-system
Priority: 2000001000
Priority Class Name: system-node-critical
Node: cluster2-controlplane/10.1.127.3
Start Time: Wed, 31 Aug 2022 05:03:45 +0000
Labels: component=kube-apiserver
tier=control-plane
Annotations: kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.1.127.3:6443
kubernetes.io/config.hash: 9bd4c04b38b27661e9e7f8b0fc1237b8
kubernetes.io/config.mirror: 9bd4c04b38b27661e9e7f8b0fc1237b8
kubernetes.io/config.seen: 2022-08-31T05:03:28.843162256Z
kubernetes.io/config.source: file
seccomp.security.alpha.kubernetes.io/pod: runtime/default
Status: Running
IP: 10.1.127.3
IPs:
IP: 10.1.127.3
Controlled By: Node/cluster2-controlplane
Containers:
kube-apiserver:
Container ID: containerd://cc64f3649222f24d3fd2eb7d5f0f17db5fca76eb72dc4c17295fb4842c045f1b
Image: k8s.gcr.io/kube-apiserver:v1.24.0
Image ID: k8s.gcr.io/kube-apiserver@sha256:a04522b882e919de6141b47d72393fb01226c78e7388400f966198222558c955
Port: <none>
Host Port: <none>
Command:
kube-apiserver
--advertise-address=10.1.127.3
--allow-privileged=true
--authorization-mode=Node,RBAC
--client-ca-file=/etc/kubernetes/pki/ca.crt
--enable-admission-plugins=NodeRestriction
--enable-bootstrap-token-auth=true
--etcd-cafile=/etc/kubernetes/pki/etcd/ca.pem
--etcd-certfile=/etc/kubernetes/pki/etcd/etcd.pem
--etcd-keyfile=/etc/kubernetes/pki/etcd/etcd-key.pem
--etcd-servers=https://10.1.127.10:2379
上述我們可以看到,ETCD server 位在 10.1.127.10:2379
:
--etcd-servers=https://10.1.127.10:2379