How to patch a ConfigMap in Kubernetes
This will apply the same patch to that single field:
kubectl patch configmap/coredns \ -n kube-system \ --type merge \ -p '{"data":{"upstreamNameservers":"[\"1.1.1.1\", \"1.0.0.1\"]"}}'
you can edit it using vi as follows:
kubectl edit cm -n kube-system coredns
or you can export it to apply any changes using kubectl get cm -n kube-system -o yaml --export
then use kubectl apply -f fileName.yaml
to apply your changes
you should try something like this:
kubectl get cm some-config -o yaml | run 'sed' commands to make updates | kubectl create cm some-config -o yaml --dry-run | kubectl apply -f -