Shakti Rath:
I am trying to filter the pods having 2 labels. I used below command but it is not returing anything
kl get pods -n sun -l ‘type=worker,type=runner’
below show labels output
kl get po -n sun --show-labels
NAME READY STATUS RESTARTS AGE LABELS
pod1 1/1 Running 0 23m type=worker
pod2 1/1 Running 0 23m type=runner
pod3 1/1 Running 0 17m protected=true
Harish Iyer:
Not aware of your aliases. But following commands should be useful.
k get pods -n sun -l type=worker
k get pods -n sun -l type=runner
Shakti Rath:
Thanks @Harish Iyer I know the command you used but I want If I can get the result in a single line rather then 2 separate command
Harish Iyer:
k get pods -n sun -L type
L –> label columns
Shakti Rath:
Can u give m the entire command?
I think it may not work but I may be wrong
Harish Iyer:
kubectl get pods -n sun -L type
Sauron:
$ k -n sun get po --show-labels
NAME READY STATUS RESTARTS AGE LABELS
pod1 1/1 Running 0 83s type=worker
pod2 1/1 Running 0 65s type=runner
pod3 1/1 Running 0 45s protected=true
$ k -n sun get po -l 'type in (worker,runner)' --show-labels
NAME READY STATUS RESTARTS AGE LABELS
pod1 1/1 Running 0 88s type=worker
pod2 1/1 Running 0 70s type=runner