Get all pods except the pods inside kube-system

Viewed 834

When I do

kubectl get pods -A

I get all pods, and I always have 17 pods that are not "apps", they belong to namespace kube-system. I would like to have an alias not to print them.

Is there a way to print all pods, excluding a namespace ?

2 Answers

You can accomplish this via field selectors:

kubectl get pods -A --field-selector=metadata.namespace!=kube-system

Additionally, the field selector list can have multiple parameters, separated by , (comma literals), and use == or != to specify additional criteria.

Related