Real world question regarding labels vs. annotations. When do we typically use . . .

Grant Powers:
Real world question regarding labels vs. annotations. When do we typically use one vs. the other, and how do you know or determine when to use an annotation vs. a label for any specific purpose?

Fernando Jimenez:
Hi @Grant Powers
It will never be a case of one vs the other. Both are necessary and a must in setting a cluster for production workloads. Annotations comes to play all the time when you need to inform or notify other components. A common one is to let an ingress controller know something. Labels are essential for a healthy cluster. It is the way to manage it, it is the way to declare objects, it is the way to link objects, it is the way of monitoring, auto scaling and more. I have never encountered a case of objects having too many labels in Kubernetes, unfortunally, I have seen the consequences of lack of proper labeling.

Grant Powers:
Thank you for the reply… very helpful. So, I’m aware of the need for annotations with ingress controllers and such and how that works. I was more referring to the comment made in the training video about labels and selectors where annotations are briefly mentioned. The example says that you can use them to annotate workloads, and the example given is a version number of the application. This seems slightly ambiguous to me in the sense that one could just as easily use a label OR an annotation OR both to express this type of data about the object. Under those circumstances, would it be more proper to use an annotation or simply a label? (hopefully that clarified my original question a bit more…)

Another good example is to add this annotation to the deployments/pods that you would like prometheus to scrape their metrics:

        <|>: 'true'

Fernando Jimenez:
If you are dealing with built-in components of the kubernetes cluster, they all know how to make use of labels. Labels is how meaning is communicated for the state. If you are dealing with components added-on or outside Kubernetes, you use annotation to provide the information.