Kubernetes – How to Get Resources Across All Namespaces by Name

kubernetesnamespaces

May be the wrong forum for such a question, but I am wondering why:

k get daemonsets.apps sysdig-agent -A

returns:

error: a resource cannot be retrieved by name across all namespaces

while

k get clusterrole sysdig-agent -A

returns:

NAME           CREATED AT
sysdig-agent   2019-05-28T08:04:01Z

I actually didn't think you could search by name across all namespaces with any object type – I am surprised it works for clusterrole, wondering what the reason is behind this?

Thanks.

Best Answer

It's because ClusterRole does not have a namespace, and thus the server just silently discarded your -A query for that resource type

Related Topic