kubectl config
Manage Kubernetes configuration (kubeconfig) files for accessing clusters via
kubectlor the Kubernetes API. By default, the Kubernetes will get its configuration from${HOME}/.kube/config. See also:kubectx,kubens. More information: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/.
- Get all contexts in the default kubeconfig file:
kubectl config get-contexts
- Get all clusters/contexts/users in a custom kubeconfig file:
kubectl config --kubeconfig
- Get the current context:
kubectl config current-context
- Set the default namespace of the current context:
kubectl config set-context --current --namespace
- Switch to another context:
kubectl config
- Delete clusters/contexts/users:
kubectl config
- Permanently add custom kubeconfig files:
export KUBECONFIG=":"
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
