Warning events across all namespaces kubectl
Cluster-wide Warning events newest last; fast triage of failing workloads
kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp
more kubectl
all 73 commands →
Find all failed pods cluster-wide
kubectl get pods -A --field-selector status.phase=Failed
Wait on a jsonpath condition
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress[0].ip}' svc/<name> -n <ns> --timeout=120s
Impersonate a user and group
kubectl auth can-i list secrets -n <ns> --as=<name> --as-group=system:serviceaccounts
Sort pods by container restart count
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.status.containerStatuses[0].restartCount}{"\n"}{end}' | sort -k3 -rn | head
Compare node allocatable vs capacity
kubectl get nodes -o json | jq -r '.items[] | {node:.metadata.name, capCPU:.status.capacity.cpu, allocCPU:.status.allocatable.cpu, capMem:.status.capacity.memory, allocMem:.status.allocatable.memory}'