Labels Flashcards
How do you get all pods that have a color label set to red?
kubectl get pods –selector=”color=red”
How do you get all pods that have the labels color and shape set to red and ball?
kubectl get pods –selector=”color=red,shape=ball”
How do you get all pods that have the label color, no matter the value?
kubectl get pods –selector=”color”
How do you get all pods that have the label color set to red or blue?
kubectl get pods –selector=”color in (red, blue)”
Give examples of use cases for annotations?
To track rollout status in rolling deployments. Add pointers to logging urls and other links.
If no prefix is used in a label, can every user see the label?
No, only labels with prefixes can be seen by other users (Needs to be tested)
What are field selectors?
Field selectors are another way of filtering resources by looking into the resources fields. For example “kubectl get pods –field-selector “metadata.name=pod-name”