<p>The certificate file of cert-manager is mounted on the nginx volume and is being used.</p>
<p>e.g</p>
<p><strong>nginx deploy.yaml -</strong></p>
<pre><code>  volumes:
    - name: secret-volume
      secret:
        secretName: my.test.app.com
    - name: configmap-volume
      configMap:
        name: nginxconfigmap
  containers:
    - name: nginxhttps
      image: bprashanth/nginxhttps:1.0
      ports:
        - containerPort: 443
        - containerPort: 80
      volumeMounts:
        - mountPath: /etc/nginx/ssl
          name: secret-volume
        - mountPath: /etc/nginx/conf.d
          name: configmap-volume
</code></pre>
<p><strong>and my nginx.conf file in</strong></p>
<pre><code>    ssl_certificate /etc/nginx/ssl/tls.crt;
    ssl_certificate_key /etc/nginx/ssl/tls.key;
</code></pre>
<p>And it's working very well.
In addition, the certificate is smoothly reissued by cert-manager.</p>
<p>However, because the reissued certificate file is not updated in the nginx container, it is said that the certificate has expired when accessed from a browser.</p>
<p>There is no problem if I force restart the pod, but I want to automate it.</p>
<p>I wonder if there is a way to automatically renew the certificate without restarting the pod forcibly.</p>

<p>Not sure that the certificate is for your specific application using <strong>Nginx</strong> or main <code>Nginx ingress</code> which is handing the whole traffic of your cluster.</p>
<p>if it is the main <strong>Nginx</strong> which is handling the whole traffic of your cluster you can create the <strong>ingress</strong> and add the <strong>cert-manager</strong> integration there.</p>
<p>Cert-manager will manage the certificate and save it inside the secret and ingress will use that secret run time. Whenever the certificate gets renew secret content will game update while ingress will be using the same secret name.</p>
<p>in the above scenario there no pod restart required.</p>
<p>if you want to read and check the whole example please refer: <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes</a></p>
<p>in the above example, Nginx will run without having any certificate in volume while it will use the certificate stored in secret.</p>
<p>For YAML example if <strong>issuer</strong> and <strong>ingress</strong> please check : <a href="https://stackoverflow.com/a/67184948/5525824">https://stackoverflow.com/a/67184948/5525824</a></p>
