<p>According to the [documentation][1] Kubernetes variables are expanded using the previous defined environment variables in the container using the syntax $(VAR_NAME). The variable can be used in the container's entrypoint.</p>
<p>For example:</p>
<pre class="lang-yaml prettyprint-override"><code>env:
- name: MESSAGE
  value: &quot;hello world&quot;
command: [&quot;/bin/echo&quot;]
args: [&quot;$(MESSAGE)&quot;]
</code></pre>
<p>Is this possible though to use bash expansion aka <code>${Var1:-${Var2}}</code> inside the container's entrypoint for the kubernetes environment variables E.g.</p>
<pre class="lang-yaml prettyprint-override"><code>env:
- name: Var1
  value: &quot;hello world&quot;
- name: Var2
  value: &quot;no hello&quot;
command: ['bash', '-c', &quot;echo ${Var1:-$Var2}&quot;]
</code></pre>

alixander
<blockquote>
<p>Is this possible though to use bash expansion aka <code>${Var1:-${Var2}}</code> inside the container's entrypoint ?</p>
</blockquote>
<p>Yes, by using</p>
<pre><code>command: 
- /bin/bash
- &quot;-c&quot;
- &quot;echo ${Var1:-${Var2}}&quot;
</code></pre>
<p>but not otherwise -- kubernetes is not a wrapper for bash, it use the Linux <code>exec</code> system call to launch programs inside the container, and so the only way to get bash behavior is to launch bash</p>
<p>That's also why they chose <code>$()</code> syntax for their environment interpolation so it would be different from the <code>${}</code> style that a shell would use, although this question comes up so much that one might wish they had not gone with <code>$</code> anything to avoid further confusing folks</p>
