Kubernetes Cookbook

Pods

List all pods on a node

kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node>

List all pods with custom outout

kubectl get pod -A -o=custom-columns=POD_NAME:.metadata.name,STATUS:.status.phase,NAMESPACE:.metadata.namespace,CONTAINER_NAME:.spec.containers[*].name

List all pods in a namespace

kubectl get pods -n <namespace>

List all pods not in the running state

kubectl get pods -n <namespace> --field-selector "status.phase!=Running"