Tips

Show kubeconfig settings

kubectl config view

Use multiple kubeconfig files at the same time

KUBECONFIG=~/.kube/config:~/.kube/kubconfig2

Permanently save the namespace for all subsequent kubectl commands in that context.

kubectl config set-context --current --namespace=ggckad-s2

Set a context utilizing a specific username and namespace

kubectl config set-context gce --user=cluster-admin --namespace=foo \
  && kubectl config use-context gce

List all services in the kube-system namespace

kubectl get svc -n kube-system

Last updated

Was this helpful?