How to remove (delete) annotation in Kubernetes

前端 未结 2 1615
别那么骄傲
别那么骄傲 2021-02-19 02:56

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 so

2条回答
  •  再見小時候
    2021-02-19 03:25

    An alternative way to achieve this goal, might be using kubectl patch command by invoking JSON patch method. Unfortunately it is more weighty solution comparing to your answer:

    kubectl patch svc --type=json -p='[{"op": "remove", "path": "/metadata/annotations/prometheus.io~1scrape"}]'

    More detailed information can be found in Jsonpatch document.

提交回复
热议问题