Kubernetes: Context & namespace
3 Kubernetes commands: Context & namespace. Click a command to see what each part does.
Kubernetes: Context & namespaceIndex
- Whole sheet137
- Basics: cluster, namespaces & resources17
- Get & list resources23
- Context & namespace3
- Find resources9
- Debug: describe, events, logs8
- Exec, port-forward, copy4
- Deploy, roll out, roll back, scale7
- Cleanup & nodes4
- Services, DNS & networking checks6
- Environment, config & secrets of workloads9
- Create, generate & apply YAML10
- Patch, label, annotate & scale9
- Delete & force delete6
- Nodes, scheduling & access control11
- Productivity: aliases, contexts & output11
Context & namespace3
kubectl config current-contextWhich cluster am I talking to?What each part does
kubectl configwork with the kubeconfig filecurrent-contextprint the active context (cluster + user + default namespace)
kubectl config get-contexts; kubectl config use-context <context>List contexts and switchWhat each part does
get-contextsall contexts; * marks the active oneuse-context <context>make <context> the default for later commands
Tip Check twice before running anything against prod.
kubectl config set-context --current --namespace=<namespace>Set the default namespace for this contextWhat each part does
set-contextedit a context--currentthe active one--namespace=<namespace>saved default namespace, so you can drop -n afterwards
Nothing matches.
My DevOps Playbook by Angelo John Calleja