問題描述
將備用 IP 地址添加到 kubernetes api 服務器 (add alternative IP address to kubernetes api server)
我正在嘗試連接到由 kubeadm 在 AWS lightail 實例(主節點和 2 個工作節點)上部署的 kubernetes 集群。我將 .kube/config 文件複製到本地計算機並將 server: https://172.26.2.101:6443
替換為 server: https://:6443
並嘗試連接。但出現以下錯誤
Unable to connect to the server: x509: certificate is valid for 10.96.0.1, 172.26.2.101, not <public_ip_address>
任何想法?!
謝謝,
參考解法
方法 1:
I've found the solution below,
remove current apiserver certificates
sudo rm /etc/kubernetes/pki/apiserver.*
generate new certificates adding the public ip
sudo kubeadm init phase certs apiserver ‑‑apiserver‑cert‑extra‑sans=<public_ip>