kubernetes – Can you do `or` kubectl label selection instead of `and`?

Is it possible to do kubectl get pods -l foo=bar||a=b instead of kubectl get pods -l foo=bar -l a=b, which gives you and instead of or?

I’ve played around with set-based requirements, but can’t seem to quite get the desired result:

$ kubectl get pods -l 'app in (microbot, foo)' -A
NAMESPACE   NAME                        READY   STATUS    RESTARTS   AGE
default     microbot-657fc66cc6-f4ll7   1/1     Running   0          18h

But, if I try and use multiple headers too

$ kubectl get pods -l 'app,k8s-app in (microbot, foobar)' -A
No resources found

Read more here: Source link