Selectors
Selectors help to choose and find the resources that you are particularly looking for using labels.
For working with selectors, here is an example find you can proceed with. The same can be extended to deployments and services.
$ kubectl create -f <file name for deployment>$ kubectl get pods - -show-labels$ kubectl get pods - -selector env=production$ kubectl get pods --selector dev-lead=carisaWorking with Multiple Selectors
$ kubectl get pods --selector env=production,dev-lead=carisa$ kubectl get pods --selector env=production,dev-lead!=carisaIn and Not In Operator
$ kubectl get pods -l 'release-version in (1.0,2.0)' $ kubectl get pods -l 'release-version notin (1.0,2.0)'Deleting pods with labels
$ kubectl delete pods -l dev-lead=carisaLast updated
Was this helpful?