Tuesday 28 July 2020

Kubernetes: List specific labels

In the previous post, I explained how to get labels associated with a resource using –show-labels option. If you want to print a specific label, then you can use the option -L.

 

For example, below statement print labels author and serviceType of all the pods.

 

kubectl get pods -L author,serviceType

$kubectl get pods -L author,serviceType
NAME               READY   STATUS    RESTARTS   AGE     AUTHOR    SERVICETYPE
employee-service   1/1     Running   0          3h31m   krishna   webservice




Previous                                                    Next                                                    Home

No comments:

Post a Comment