<p>I have an <em>optional</em> secret volume defined in my StatefulSet like</p>

<pre><code>  - name: my-secret-volume
    secret:
      secretName: my-secret
      optional: true
</code></pre>

<p>And further, I mount it in my container. When I provision the pod, the secret does not exist yet.</p>

<p>Later, another service is installed on the cluster, which creates <code>my-secret</code>. Is there any way to mount that secret inside my pod where it was originally marked as optional, without having to restart the pod?</p>

<p>Apparently, mounted secrets are updated automatically. From <a href="https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets</a> :</p>

<blockquote>
  <p>When a secret being already consumed in a volume is updated, projected
  keys are eventually updated as well. Kubelet is checking whether the
  mounted secret is fresh on every periodic sync.</p>
</blockquote>

<p>I have tested it manually, defined <code>my-secret</code> and it eventually (in under a minute) showed up in the mounted path, which was previously empty (before I created <code>my-secret</code>).</p>
