# 创建并设置 kubeconfig
kubectl config set-cluster example --server=$APISERVER --embed-certs --certificate-authority=$K8S_CA
kubectl config set-credentials test --embed-certs --client-certificate=$K8S_CLIENT_DIR/test.crt --client-key=$K8S_CLIENT_DIR/test.key
kubectl config set-context test@example --cluster=example --user=test
kubectl config use-context test@example
# 查看 kubeconfig
kubectl config view --minify
# kubectl 测试访问
kubectl get pods
|