Dump all pods to a YAML file
Saves the full state of all pods in a namespace for backup or analysis
kubectl get pods -n <ns> -o yaml > pods-dump.yaml
- tool
- kubectl73 commands
More kubectl commands
-
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{range .spec.containers[*]}{.image}{"\n"}{end}{end}'Shows every container image running in the cluster, with namespace and pod
-
kubectl config use-context <context>Changes the active cluster context
-
kubectl config get-contextsShows all contexts in the current kubeconfig
-
KUBECONFIG=~/.kube/config:~/.kube/cluster2.yaml kubectl config view --flatten > ~/.kube/merged.yamlCombines several kubeconfig files into one
-
kubectl config set-context --current --namespace=<ns>No more typing -n in every command for this context