1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-03 21:15:32 +02:00

kubectl-config: add page (#13223)

This commit is contained in:
Tran Dinh Dong 2024-07-07 14:41:23 +07:00 committed by GitHub
parent 9e0c7e66bf
commit c77913904c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,30 @@
# kubectl config
> Manage Kubernetes configuration (kubeconfig) files for accessing clusters via `kubectl` or 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/generated/kubectl/kubectl-commands#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 {{get-clusters|get-contexts|get-users}} --kubeconfig {{path/to/kubeconfig.yaml}}`
- Get the current context:
`kubectl config current-context`
- Switch to another context:
`kubectl config {{use|use-context}} {{context_name}}`
- Delete clusters/contexts/users:
`kubectl config {{delete-cluster|delete-context|delete-user}} {{cluster|context|user}}`
- Permanently add custom kubeconfig files:
`export KUBECONFIG="{{$HOME.kube/config:path/to/custom/kubeconfig.yaml}}" kubectl config get-contexts`