Kubectl update configMap

前端 未结 3 488
说谎
说谎 2021-02-12 10:07

I am using the following command to create a configMap.

kubectl create configmap test --from-file=./application.properties --from-file=./mongo.properties --from-         


        
3条回答
  •  盖世英雄少女心
    2021-02-12 11:06

    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

提交回复
热议问题