Annotations
As we have seen previously, labels are used to add the identifying metadata that we can later use to filter or select objects by. However, labels have certain constraints in terms of what we can store in the values, such as the limitation of 63 characters and alphanumeric characters at the beginning and end. Annotations, on the other hand, have fewer constraints in terms of what kind of data can be stored in them. However, we cannot filter or select objects by using annotations.
Annotations are also key-value pairs that can be used to store the unstructured information pertaining to the Kubernetes objects. Here is an example of how annotations in a YAML file would appear:
metadata: Â Â annotations: Â Â Â Â key1: value1 Â Â Â Â key2: value2
Constraints for Annotations
As noted in the previous section, annotations are key-value pairs, just like labels. However, the rules for annotations are more relaxed than the rules for...