<p>I'd like to mount volume if it exists. For example:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - name: mypod
    image: redis
    volumeMounts:
    - name: foo
      mountPath: "/etc/foo"
  volumes:
  - name: foo
    secret:
      secretName: mysecret
</code></pre>

<p>is the example from the documentation. However if the secret <code>mysecret</code> doesn't exist I'd like to skip mounting. That is optimistic/optional mount point.</p>

<p>Now it stalls until the secret is created.</p>

nmiculinic
<p>secret and configmap volumes can be marked optional, and result in empty directories if the associated secret or configmap doesn't exist, rather than blocking pod startup</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: mypod
      image: redis
      volumeMounts:
        - name: foo
          mountPath: /etc/foo
  volumes:
    - name: foo
      secret:
        secretName: mysecret
        optional: true
</code></pre>
