Check kubectl and server version
Show client and server version details.
kubectl version --shortCore kubectl troubleshooting commands for pods, deployments, services, events, logs, exec sessions, and ephemeral debugging.
Show client and server version details.
kubectl version --shortDisplay the control plane and addon URLs known to kubectl.
kubectl cluster-infokubectl get nodeskubectl get nodes -o widekubectl get all -Akubectl api-resourcesCollect broad cluster state for troubleshooting.
kubectl cluster-info dumpkubectl get pods -Akubectl get pods -A -o widekubectl get pod <pod> -n <namespace> -o yamlkubectl describe pod <pod> -n <namespace>kubectl get deployments -AInspect replica counts, rollout conditions, and selector details.
kubectl describe deployment <name> -n <namespace>kubectl rollout status deployment/<name> -n <namespace>See which ReplicaSet a rollout created and whether scaling succeeded.
kubectl get rs -n <namespace>kubectl get statefulsets -Akubectl describe job <name> -n <namespace>kubectl get events -n <namespace>kubectl get events -n <namespace> --sort-by=.metadata.creationTimestampkubectl get events -A --sort-by=.metadata.creationTimestampUse readiness conditions to gate troubleshooting steps or scripts.
kubectl wait --for=condition=Ready pod/<pod> -n <namespace> --timeout=60skubectl get pods -n <namespace> -o custom-columns=NAME:.metadata.name,PHASE:.status.phase,REASON:.status.containerStatuses[0].state.waiting.reasonkubectl logs <pod> -n <namespace>kubectl logs <pod> -n <namespace> -c <container>kubectl logs -f <pod> -n <namespace>kubectl logs <pod> -n <namespace> -pkubectl logs -n <namespace> -l app=<label> --all-containers=true --prefixkubectl exec -it <pod> -n <namespace> -- /bin/shQuickly validate environment and injected secrets names.
kubectl exec <pod> -n <namespace> -- envkubectl cp <namespace>/<pod>:/path/in/pod ./local-fileLaunch a temporary debugging container in an existing pod.
kubectl debug -it <pod> -n <namespace> --image=busybox:1.36 --target=<container>Duplicate a pod and add a debug container or different command.
kubectl debug <pod> -n <namespace> --copy-to=<pod>-debug --container=debugger --image=busybox:1.36 -itkubectl port-forward pod/<pod> -n <namespace> 8080:80Spot frequently restarting containers quickly.
kubectl get pods -A -o custom-columns=NS:.metadata.namespace,POD:.metadata.name,RESTARTS:.status.containerStatuses[*].restartCountCorrelate pod failures with node placement.
kubectl get pods -A -o custom-columns=NS:.metadata.namespace,POD:.metadata.name,NODE:.spec.nodeNameFind image tags currently running in the cluster.
kubectl get pods -A -o jsonpath='{..image}' | tr -s '[[:space:]]' '
' | sort | uniq -ckubectl get pods -A --field-selector=status.phase!=RunningRequires metrics-server; useful for resource-based incidents.
kubectl top pods -Akubectl top nodes