Update k8s ConfigMap or Secret without deleting the existing one

后端 未结 5 947
梦如初夏
梦如初夏 2020-12-07 11:39

I\'ve been using K8S ConfigMap and Secret to manage our properties. My design is pretty simple, that keeps properties files in a git repo and use build server such as Though

5条回答
  •  醉酒成梦
    2020-12-07 12:09

    Take a copy of the existing configmap:

    kubectl get configmap foo -o yaml > foo.yaml
    

    And then do the modifications and use apply command, this should work.

    kubectl apply -f foo.yaml
    

    Note: Incase if you see any of the following issue, then include latest "resourceVersion" from the existing config map and try again.

    " Operation cannot be fulfilled on configmaps "foo": the object has been modified; please apply your changes to the latest version and try again"

提交回复
热议问题