Deleting An Annotation
For deleting an annotation, we use a dash (“–“) at the end of the annotation key. For deleting the description annotation, enter the following command in your terminal:
kubectl annotate service example description-
This will delete the description annotation and now when you use
kubectl describe service example
for checking the example service information. You will see we have only two annotations left and the description annotation is deleted. You will see a similar output:
How to Use Kubernetes Annotations?
Annotations are key-value pairs that are used to attach non-identifying metadata to Kubernetes objects. Various tools that are built over Kubernetes use this metadata attached by annotations to perform actions or enhance resource management. Labels and Annotations are used to attach metadata to Kubernetes objects. This makes annotations important for working with Kubernetes clusters. To learn more about Kubernetes cluster and its architecture refer to Kubernetes – Architecture.