ORing label selectors with kubectl
Let’s say you want, using the kubectl
, to get all pods
with label tier=backend
OR tier=frontend
.
Did you know you could do the following?
|
|
We at $WORK did not.
It’s actually even more powerful, you can use notin
, you can combine with ,
to perform AND. I recommend reading the docs for more examples.
Also, if you are at the exploration phase, don’t forget to pass --show-labels
to have a understanding of the existing labels.
Or, if you want to reduce the clutter and only display the fields you are interested in:
|
|
Here’s a confession: sometimes I give up and just pipe to classic unix tools:
|
|