<p>I am using v1beta2 of kubernetes and I have <code>Deployment</code> kind of configuration. 
In this configuration, I have a base conf of my app and I want to add <strong>conditionally</strong> a second docker image (container) in the same pod.</p>

<p>My config file : </p>

<pre><code>apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: ${MY_APP_NAME}
spec:
   containers:
    - name: my_first_container
      image: image_url
[...]
    - name: my_second_container &lt;------ I want to put conditional declaration of this container
[...]
</code></pre>

<p>I don't want to add the second container in a spearate pod. </p>

<p>The condition is based on a variable like ${K8S_CONTAINER2_CONDITION} valued by sed command in linux. 
This command replace variables like ${MY_APP_NAME}.</p>

<p>How can I put conditional declaration of this container ? 
For some applications, I need to deploy both containers and for others, only the first one. But I have only one k8s configuration file (yaml).</p>

slim
<p>you should look at helm charts for customizing the deployment file at deploy time</p>
