Kubernetes: showing all resources in a namespace

The “kubectl get all” command only returns a limited set of resources, namely: pods, services, daemon sets, deployments, replica sets, jobs, cronjobs, and stateful sets (not Ingress, Secrets, ConfigMap, CRD, etc.).

While there is a rationale for this, it is often the case we need to see all the resources and custom resources defined in a namespace.

The command below will return all the resources and custom resources defined in a Kubernetes namespace (1,2).

kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n <namespace>

REFERENCES

kubernetes.io docs, kubectl api-resources

stackoverflow, how to display all type in k8s namespace

Kubernetes github issue, explains why not all types are shown in ‘kubectl get all’

Adeyomoloa Kazeem, list all resources in k8s namespace

stackoverflow, curl command to kubeapi resources also running kubectl to https://kubernetes.default from inside cluster using service token

NOTES

List all resource definitions and supported verbs

kubectl api-resources -o wide