Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove (delete) annotation in Kubernetes

Tags:

kubernetes

Is there a different way than kubectl edit to delete an annotation in Kubernetes?

I do not like the interactivity of kubectl edit. I prefer something usable in a script.

like image 886
Michal Foksa Avatar asked Mar 03 '19 20:03

Michal Foksa


People also ask

How do I update my pod annotations?

show that, using kubectl, the operator can change the annotations on a single pod. In other words, API server UPDATE requests for pods can contain changes to the annotations field.

What is annotate in Kubernetes?

You can use Kubernetes annotations to attach arbitrary non-identifying metadata to objects. Clients such as tools and libraries can retrieve this metadata.


1 Answers

Use minus - sign at the end of the annotation in kubectl annotate.

Example:

kubectl annotate service shopping-cart prometheus.io/scrape-

Removes annotation prometheus.io/scrape from shopping-cart service.

like image 59
Michal Foksa Avatar answered Oct 11 '22 14:10

Michal Foksa