配置 Kubectl
每一个 kubeconfig 都需要一个 Kuberntes API Server 地址。为了保证高可用,这里将使用 API Servers 前端外部负载均衡器的 IP 地址。
为 admin
用户生成 kubeconfig 文件:
kubectl config set-cluster kubernetes-the-hard-way \
--certificate-authority=ca.pem \
--embed-certs=true \
--server=https://${KUBERNETES_PUBLIC_ADDRESS}:6443
kubectl config set-credentials admin \
--client-key=admin-key.pem
kubectl config set-context kubernetes-the-hard-way \
--cluster=kubernetes-the-hard-way \
--user=admin
kubectl config use-context kubernetes-the-hard-way
验证
检查远端 Kubernetes 群集的健康状况:
scheduler Healthy ok
etcd-2 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}
etcd-1 Healthy {"health": "true"}
列出远端 kubernetes cluster 的节点:
输出为
NAME STATUS ROLES AGE VERSION
worker-0 Ready <none> 117s v1.12.0
worker-2 Ready <none> 118s v1.12.0