接着上面的博客继续写
pwd
/etc/kubernetes
设置集群参数
kubectl config set-cluster kubernetes --certificate-authority=/etc/kubernetes/ssl/ca.pem --server=https://192.168.1.71:6443 --kubeconfig=kube-proxy.kubeconfig
设置客户端认证参数
kubectl config set-credentials kube-proxy --client-certificate=/etc/kubernetes/ssl/kube-proxy-1-71.pem --client-key=/etc/kubernetes/ssl/kube-proxy-1-71.key --kubeconfig=kube-proxy.kubeconfig
设置上下文参数
kubectl config set-context default --cluster=kubernetes --user=kube-proxy --kubeconfig=kube-proxy.kubeconfig
设置默认上下文
kubectl config use-context default --kubeconfig=kube-proxy.kubeconfig
cat kube-proxy.kubeconfig
apiVersion: v1 clusters: - cluster: certificate-authority: ssl/ca.pem server: https://192.168.1.71:6443 name: kubernetes contexts: - context: cluster: kubernetes user: kube-proxy name: default current-context: default kind: Config preferences: {} users: - name: kube-proxy user: as-user-extra: {} client-certificate: ssl/kube-proxy-1-71.pem client-key: ssl/kube-proxy-1-71.key