1. 从 Kubernetes 版本页面 下载最新的 kubectl 客户端。
2. 安装和设置 kubectl 客户端。有关详细信息,参见 安装和设置 kubectl
3. 配置集群凭据:
将以下内容复制到计算机 $HOME/.kube/config
apiVersion: v1
clusters:
- cluster:
server: https://0.0.0.0:6443
certificate-authority-data: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: "kubernetes-admin"
name: kubernetes-admin-cefaaa203ac2f468f9e2e5c0663d9b1a9
current-context: kubernetes-admin-cefaaa203ac2f468f9e2e5c0663d9b1a9
kind: Config
preferences: {}
users:
- name: "kubernetes-admin"
user:
client-certificate-data: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
client-key-data: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
配置完成后,您即可以使用 kubectl 从计算机访问 Kubernetes 集群。