List all resources in a namespace
Go through every resource type in a namespace; useful for audits
kubectl api-resources --verbs=list --namespaced -o name | xargs -I{} kubectl get {} -n <ns> --ignore-not-found
More k8s-debug commands
-
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}\t{.metadata.name}\t{.status.phase}\n{end}'Print the namespace, name and phase of every pod with JSONPath, no jq needed
-
kubectl debug -it mypod --image=busybox --target=appAttach an ephemeral busybox container to a running pod; --target lets it see the app container processes
-
kubectl debug node/my-node -it --image=ubuntuGet a shell on a cluster node through a debug pod; the node filesystem is mounted at /host
-
kubectl exec -it mypod -c sidecar-name -- /bin/shOpen a shell in one container of a multi-container pod
-
kubectl get pod mypod -o jsonpath='{range .spec.containers[*]}{.name}{"\t"}{.resources}{"\n"}{end}'Show resource requests and limits for each container