I would like to see all resources in a namespace.
Doing kubectl get all
will, despite of the name, not list things like services and ingresses.
If I know the the type I can explicitly ask for that particular type, but it seems there is also no command for listing all possible types. (Especially kubectl get
does for example not list custom types).
Any idea how to show all resources before for example deleting that namespace?
The most basic command for viewing Kubernetes objects via kubectl is get . If you run kubectl get <resource-name> you will get a listing of all resources in the current namespace. If you want to get a specific resource, you can use kubectl get <resource-name> <object-name> .
Based on this comment , the supported way to list all resources is to iterate through all the api versions listed by kubectl api-resources
:
kubectl api-resources enumerates the resource types available in your cluster.
this means you can combine it with kubectl get to actually list every instance of every resource type in a namespace:
kubectl api-resources --verbs=list --namespaced -o name \ | xargs -n 1 kubectl get --show-kind --ignore-not-found -l <label>=<value> -n <namespace>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With