We saw an introduction to labels in our article here. In this article let’s try to understand the differences between labels and annotation & when to use one over another.
Let’s quickly summarize what we learnt about labels
Why use Labels in K8s?
Labels allow K8s to group a set of related resources(example:- all prod resources). Selectors are used to query those labels(example:- get me all prod resources). Official Docs here. Something to note, at the time of writing of this article, below are the restrictions on how a label must be defined in K8s
Valid label value:
#kubernetes