Delete key from configmap in Kubernetes

Viewed 6271

Is there a nice way to delete a specific key from a Kubernetes configmap, using kubectl?

Right now I run:

$ kubectl edit configmap myconfigmap

and then I delete the entry but I would like a solution that can be run as a script.

1 Answers

This works but I wonder if there is a simpler way

$ kubectl patch configmap myconfigmap --type=json -p='[{"op": "remove", "path": "/data/mykey"}]'
Related