<p>From the docs:</p>

<blockquote>
  <p>Secrets must be created before they are consumed in pods as environment variables unless they are marked as optional. References to Secrets that do not exist will prevent the pod from starting.</p>
</blockquote>

<p>How to mark secret as optional? </p>

<p>What you're looking for is</p>
<pre><code>  - name: ENV_NAME
    valueFrom:
      secretKeyRef:
        name: &lt;secrets name&gt;
        key: &lt;secrets key&gt;
        optional: true
</code></pre>
<p>You can find type definition <a href="https://github.com/kubernetes/kubernetes/blob/e9e190c57c61a88a2ba96c4b0688b8eb3a8945a8/pkg/apis/core/types.go#L1762" rel="noreferrer">here</a></p>
<p>Edit: similarly for <code>envFrom</code></p>
<pre><code>envFrom:
- secretRef:
    name: secname
    optional: true
</code></pre>
