Labels are used to work with objects or collections of objects; while annotations facilitate object interaction outside of kubernetes through object metadata. Similar to labels, they are key to value maps. They are also able to hold more information, and more human-readable information than labels.
This kind of metadata can be used to track information such as a timestamp, pointers to related objects from other ecosystems, or even a developer’s email responsible for that object’s creation.
The annotation data could be held in an exterior database, but that would reduce the data flexibility. Inclusion of such metadata facilitates easier integration of 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. See the following commands:
$ kubectl annotate pods –all description=’Development Pods’ -n dev
$ kubectl annotate –overwrite pod jenkinpod description=”Old Jenkins Pods” -n web $ kubectl -n web annotate pod jenkinpod description-