<p>I'm trying to create a Nginx server using Kubernetes and the official docker image. Unfortunately, when I'm trying to mount a custom config file, nothing happen. My container works just fine but with it's default configuration file. Moreover the another mount on /etc (the lets encrypt folder) doesn't work too. Nevertheless the certbot mount works just fine...
(If I check inside the container /etc/nginx/nginx.conf it's not the file I'm trying to mount, and /etc/letsencrypt doesn't exist)
I link my deployment file just below..
If someone has an idea and want to help it would be delightful !</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1 
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.19.6
        ports:
        - containerPort: 80
        - containerPort: 443 
        volumeMounts:
        - name: nginx-config
          mountPath: /etc/nginx/nginx.conf
          subPath: nginx.conf
          readOnly: true
        volumeMounts:
        - name: letsencrypt
          mountPath: /etc/letsencrypt
          readOnly: true
        volumeMounts:
        - name: certbot
          mountPath: /var/www/certbot
      volumes:
        - name: nginx-config
          nfs: 
            server: 192.168.2.9
            path: /volume1/nginx/nginx.conf     
        - name: letsencrypt
          nfs: 
            server: 192.168.2.9
            path: /volume1/nginx/letsencrypt
        - name: certbot
          nfs: 
            server: 192.168.2.9
            path: /volume1/nginx/certbot
</code></pre>
<p><strong>Edit :</strong>
To solve this problem I had to put all my volume mount inside a single volumeMount section and to remove the reference to file in the volume section, like this :</p>
<pre><code>    volumeMounts:
    - name: nginx-config
      mountPath: /etc/nginx/nginx.conf
      subPath: nginx.conf
      readOnly: true
    - name: letsencrypt
      mountPath: /etc/letsencrypt
      readOnly: true

    - name: certbot
      mountPath: /var/www/certbot
  volumes:
    - name: nginx-config
      nfs: 
        server: 192.168.2.9
        path: /volume1/nginx/    
    - name: letsencrypt
      nfs: 
        server: 192.168.2.9
        path: /volume1/nginx/letsencrypt
    - name: certbot
      nfs: 
        server: 192.168.2.9
        path: /volume1/nginx/certbot
</code></pre>

tellierflexus
<p>I'm writing this answer as community wiki for better visibility of OP solution which was placed as an edit to question instead of answer.</p>
<p>The solution for the problem was combination of OP solution to putt all the volumes mount inside singe <code>volumeMount</code> with my answer to remove the reference to a file in the volume section:</p>
<pre><code>    volumeMounts:
    - name: nginx-config
      mountPath: /etc/nginx/nginx.conf
      subPath: nginx.conf
      readOnly: true
    - name: letsencrypt
      mountPath: /etc/letsencrypt
      readOnly: true

    - name: certbot
      mountPath: /var/www/certbot
  volumes:
    - name: nginx-config
      nfs: 
        server: 192.168.2.9
        path: /volume1/nginx/    
    - name: letsencrypt
      nfs: 
        server: 192.168.2.9
        path: /volume1/nginx/letsencrypt
    - name: certbot
      nfs: 
        server: 192.168.2.9
        path: /volume1/nginx/certbot
</code></pre>
