Delete key from configmap in Kubernetes

9/13/2018

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.

-- rvabdn
configmap
kubectl
kubernetes

1 Answer

9/13/2018

This works but I wonder if there is a simpler way

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