I want to achieve this command use kubernetes python client.
kubectl -n namespace get all -l key=value
I've seen several questions here List all resources in a namespace using the Kubernetes python client
but it's means
kubectl api-resources
not what I want.
I can't find an example case, so what is the right way to do this?
namespaced resources in Kubernetes api is structured like:
just for resources accessible by Core API
to have access to other resources like StatefulSets, you need to use Apps API
at the end of the day, you need to name all resources you need to retrieve,
You can use
get_api_resources()to list all resource names possible, and then iterate over them like the code above, inform in the comments if you needed help.