15

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.

Michael Hausenblas
  • 13,162
  • 4
  • 52
  • 66
rvabdn
  • 947
  • 6
  • 20

1 Answers1

26

This works but I wonder if there is a simpler way

$ kubectl patch configmap myconfigmap --type=json -p='[{"op": "remove", "path": "/data/mykey"}]'
rvabdn
  • 947
  • 6
  • 20
  • There are no `kubectl` commands to edit configmaps as of now, so `patch` is the way to go - and how simpler than a single command do you want to go? :) – mhutter Sep 13 '18 at 22:16