Kubernetes
Debug Toolkit

kubectl debug --help

Filterable reference for K8s debugging: from pod inspection to cluster-wide security audits.

18 tools
6 phases
K8s 1.28+, CRI-O, containerd
Phase 18 tools shown
ToolPhaseKey commandsUse case
kubectl inspect
kubectl get pods -A -o wide kubectl describe pod <pod> -n <ns> kubectl logs <pod> -n <ns> -f --previous kubectl logs <pod> -c <container> --tail=100 kubectl exec -it <pod> -n <ns> -- /bin/sh kubectl get events -A --sort-by=.metadata.creationTimestamp
Pod state, logs, events, exec. First stop for any debugging session. --previous fetches logs from a crashed container.
k9s inspect
k9s k9s --context prod --namespace default k9s --kubeconfig ~/.kube/config # :pod → select → l (logs) d (describe) s (shell) # :svc :deploy :ns :node; navigate resources
Real-time interactive TUI for K8s. Faster than repeated kubectl calls. Port-forward, delete, edit all in-view.
stern inspect
stern <pod-regex> -n <ns> stern . -n <ns> --since 5m stern <pod> --container <c> -o json | jq . stern . -A --include "ERROR|WARN"
Multi-pod/container log tail with colour-coded prefixes. Replaces juggling multiple kubectl logs sessions.
kubectx / kubens inspect
kubectx kubectx prod kubectx - kubens kube-system kubens -
Fast context and namespace switching. - reverts to previous. Eliminates --context and -n flags everywhere.
kubectl debug inspect
kubectl debug -it <pod> --image=nicolaka/netshoot --copy-to=debug-pod kubectl debug -it <pod> --image=busybox --target=<container> kubectl debug node/<node> -it --image=ubuntu
Ephemeral debug containers for distroless or scratch images that have no shell. Node-level debug gets a privileged pod on a specific node.
crictl inspect
crictl ps -a crictl logs <container-id> crictl inspect <container-id> crictl images crictl pods
CRI-level inspection: bypasses the API server. Essential when kubelet is unhealthy or a pod never reaches Running.
netshoot network
kubectl run tmp --rm -it --image=nicolaka/netshoot -- bash kubectl run tmp --rm -it --image=nicolaka/netshoot -n <ns> -- curl http://<svc>.<ns>.svc.cluster.local # includes: curl dig nmap tcpdump iperf3 ss ip
In-cluster network swiss-army knife. Run alongside a misbehaving pod to test DNS, connectivity, and latency from inside the mesh.
kubectl port-forward network
kubectl port-forward svc/<svc> 8080:80 -n <ns> kubectl port-forward pod/<pod> 9090:9090 kubectl port-forward deployment/<deploy> 5432:5432
Expose cluster services locally without an Ingress or LoadBalancer. Works for Prometheus, Postgres, internal APIs.
DNS debugging network
kubectl run dnstest --rm -it --image=busybox -- nslookup kubernetes kubectl run dnstest --rm -it --image=busybox -- nslookup <svc>.<ns>.svc.cluster.local kubectl get configmap coredns -n kube-system -o yaml kubectl logs -n kube-system -l k8s-app=kube-dns
Diagnose CoreDNS failures, NDOTS issues, and service discovery misconfigs. Most K8s network bugs start here.
networkpolicy audit network
kubectl get networkpolicies -A -o yaml kubectl describe networkpolicy <name> -n <ns> nptest --pod <pod> --namespace <ns>
Verify ingress/egress rules, identify overly permissive or blocking policies. Run after unexpected connection refused errors.
trivy security
trivy image <image>:<tag> trivy image --severity CRITICAL,HIGH <image> trivy k8s --report summary cluster trivy k8s --report all -n <ns> trivy fs --security-checks vuln,config .
Image CVE scanning + K8s cluster misconfiguration audit in one tool. The k8s subcommand hits the live cluster via kubeconfig.
kube-bench security
kube-bench run --targets node kube-bench run --targets master kube-bench run --benchmark eks-1.2.0 kube-bench --json | jq '.Controls[].tests[].results[] | select(.status=="FAIL")'
CIS Kubernetes Benchmark checks against control plane and nodes. Supports EKS, GKE, AKS profiles.
kubescape security
kubescape scan framework nsa kubescape scan framework mitre kubescape scan --severity-threshold high kubescape scan -n <ns> --format json | jq .
Multi-framework security posture scanner (NSA, MITRE, CIS). Runs against live cluster or local manifests.
kubectl top health
kubectl top nodes kubectl top pods -A --sort-by=cpu kubectl top pods -A --sort-by=memory kubectl top pod <pod> --containers
Live CPU/memory usage from metrics-server. First check for OOMKilled and noisy-neighbour issues.
popeye health
popeye popeye -n <ns> popeye -o json | jq '.popeye.sections[] | select(.title=="Deployments")' popeye --save --out html --output-file report.html
Cluster linter: surfaces unused resources, missing probes, resource limits, deprecated APIs, and misconfigured services.
kube-score health
kube-score score manifests/*.yaml helm template . | kube-score score - kube-score score deploy.yaml --output-format ci
Static manifest analysis: checks resource limits, security contexts, probes, anti-affinity before anything hits the cluster.
kubectl auth rbac
kubectl auth can-i --list kubectl auth can-i create pods --as=<user> kubectl auth can-i '*' '*' --all-namespaces kubectl auth can-i --list --as=system:serviceaccount:<ns>:<sa>
Verify what a user or service account is actually allowed to do. Essential before and after RBAC changes.
rakkess rbac
rakkess rakkess --as <user> rakkess --as system:serviceaccount:<ns>:<sa> -n <ns> rakkess resource pods --verbs get,list,delete
Full RBAC access matrix for any subject: shows every verb across every resource at a glance. Far clearer than kubectl auth can-i one-by-one.
PV / PVC debug storage
kubectl get pv,pvc -A -o wide kubectl describe pvc <name> -n <ns> kubectl get events -n <ns> --field-selector involvedObject.name=<pvc> kubectl exec -it <pod> -- df -h kubectl exec -it <pod> -- ls -la /data
Diagnose Pending PVCs, capacity issues, ReclaimPolicy mistakes, and mount failures inside pods.
kubectl cp storage
kubectl cp <pod>:/path/to/file ./local -n <ns> kubectl cp ./local <pod>:/tmp/file -n <ns> kubectl cp <pod>:/var/log ./logs -c <container>
Extract logs, configs, or crash dumps from pods without exposing a service. Requires tar in the container image.
No tools match this filter.