kubectl config set-context dev --namespace=development \ --cluster=kubernetes \ --user=kubernetes-admin code example
Example: kubectl use context
kubectl config view
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2
kubectl config view
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
kubectl config view -o jsonpath='{.users[].name}'
kubectl config view -o jsonpath='{.users[*].name}'
kubectl config get-contexts
kubectl config current-context
kubectl config use-context my-cluster-name
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword
kubectl config set-context --current --namespace=ggckad-s2
kubectl config set-context gce --user=cluster-admin --namespace=foo \
&& kubectl config use-context gce
kubectl config unset users.foo