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?
Based on this comment , the supported way to list all resources is to iterate through all the api versions listed by
kubectl api-resources
:All kubernetes objects are stored in etcd.
All objects are stored in ETCD v3 the following way:
I suggest just to take the list of all resources of some namespace from etcd v3 directly:
the easy way for me to retrieve all the contents of the namespace was kubectl get all -n
A Powershell implementation of rcorre's answer would look like
I ended up needing this same functionality due to failed Helm deployments that left remnants in a specific namespace. Here's a function you can put in your bash profile:
Usage:
kubectlgetall <namespace>
Example: get all resources from the
kafka
namespace:kubectlgetall kafka
This seems to get most of the resources, prefixed with the type.
At least, it gets:
This doesn't get custom resources but does get services.
Else this does something similar:
Running v1.13