Using Annotations
Labels are used to work with objects or collections of objects; annotations are not.
Instead, annotations allow for metadata to be included with an object that may be helpful outside of the Kubernetes object interaction. Similar to labels, they are key to value maps. They are also able to hold more information, and more human-readable information than labels.
Having this kind of metadata can be used to track information such as a timestamp, pointers to related objects from other ecosystems, or even an email from the developer responsible for that object's creation.
The annotation data could otherwise be held in an exterior database, but that would limit the flexibility of the data. The more this metadata is included, the easier it is to integrate management and deployment tools or shared client libraries.
For example, to annotate only Pods within a namespace, you can overwrite the annotation, and finally delete it:
$ kubectl annotate pods --all description='Production Pods' -n prod
$ kubectl annotate --overwrite pod webpod description="Old Production Pods" -n prod
$ kubectl -n prod annotate pod webpod description-
Last updated