<p>I have following configmaps</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: test
data:
  application.properties: |+
  key1: value1
  key2: value2
  keyN: valueN
</code></pre>
<p>Configmaps is mounted to pod and works fine.</p>
<p>My requirement is to programmatically  replace the value for some of the keys.
I can run shell/python script and I can run any kubectl command.</p>

pythonhmmm
<p>You can use <code>kubectl patch</code> command to update K8s resources.</p>
<pre><code>kubectl patch configmap/test \
  --type=json \
  '-p=[{&quot;op&quot;: &quot;replace&quot;,&quot;path&quot;: &quot;/data/key1&quot;, &quot;value&quot;: &quot;test1&quot;}]'
</code></pre>
<p><strong>An important point to note as mentioned by Henry is that the application also has to re-read the properties after they have been changed.</strong></p>
