I am using the following command to create a configMap.
kubectl create configmap test --from-file=./application.properties --from-file=./mongo.properties --from-
Another option is actually you can use this command:
kubectl create configmap some-config --from-file=some-key=some-config.yaml -n some-namespace -o yaml --dry-run | kubectl apply -f -
Refer to Github issue: Support updating config map and secret with --from-file
Now you can. Just throw: kubectl edit configmap <name of the configmap>
on your command line. Then you can edit your configuration.
No, you can't.
Replace in kubernetes will simply replace everything in that configmap. You can't just update one file or one single property in it.
However, if you check with the client Api, you will find if you create a configmap with lots of files. Then, those files will be stored as a HashMap, where key is file name by default, value is the file content encoded as a string. So you can write your own function based on existing key-value pair in HashMap.
This is what I found so far, if you find there is already existing method to deal with this issue, please let me know :)
FYI, if you want to update just one or few properties, it is possible if you use patch. However, it is a little bit hard to implement.
this and this may help