<p>I want to write docker image name in kubernetes config and then use it in in my deployment file instead of directly hardcoding it.
So instead of:</p>

<p><strong><code>image: "nginx:latest</code>"</strong></p>

<p>I want to do following:</p>

<pre><code>image:
 valueFrom:
  configMapKeyRef:
   name: docker-config
   key: docker-image
</code></pre>

<p>How can it be done or any other alternatives?
Thanks.</p>

Mayank Senani
<p>If you want to <strong>update</strong> the <strong>value</strong> of image key you can use following <strong>data-driven commands</strong> by using <strong>set</strong> verb for example </p>

<pre><code>  # Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
  kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1

  # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'
  kubectl set image deployments,rc nginx=nginx:1.9.1 --all

  # Update image of all containers of daemonset abc to 'nginx:1.9.1'
  kubectl set image daemonset abc *=nginx:1.9.1

  # Print result (in yaml format) of updating nginx container image from local file, without hitting the server
  kubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml
</code></pre>

<p>you can get more detail by using </p>

<pre><code>kubectl set image --help
</code></pre>

<p>here are more example for <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#updating-resources" rel="noreferrer">updating-resources</a></p>
