kubectl config set-credentials tf-admin --token=***************

kubectl config set-cluster tf-cluster --insecure-skip-tls-verify=true --server=https://{kube-apiserver}

kubectl config set-context tf-system --cluster=tf-cluster --user=tf-admin

kubectl config use-context tf-system

-==================================-

kubectl config set-credentials qa-admin --username=admin --password=******

kubectl config set-cluster qa-cluster --server={kube-apiserver} --certificate-authority=/etc/kubernetes/cluster-ca.crt

kubectl config set-context qa-system --cluster=qa-cluster --user=qa-admin

kubectl config use-context qa-system


后面的配置是通过账号密码设置来访问api-server