Unable to mount 2 volumeMounts into nginx container in kubernetese, container start but nginx no

38 Views Asked by At

I'm trying to mount 2 volumeMounts in the same container in kubernates but it seems that with volume 2 the nginx service does not start

This is the yaml I use

apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - name: myfrontend image: nginx volumeMounts: - mountPath: "/var/www/html" name: mypd - mountPath: "/etc/nginx/conf.d" name: mypd volumes: - name: mypd persistentVolumeClaim: claimName: nginx-pvc


pv and pvc are already present without problems.
If deploy the above manifest the pod start but if, inside the pod, execute a netstat -ntlp the result is this

root@nginx:/etc/nginx/conf.d# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
root@nginx:/etc/nginx/conf.d#





If deploy the same manifest but wiht only one volumeMounts al works fine

`apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
    - name: myfrontend
      image: nginx
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: nginx-pvc`

root@nginx:/# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1/nginx: master pro
tcp6       0      0 :::80                   :::*                    LISTEN      1/nginx: master pro

Do I have to create a PVC for each volumeMounts?

Thanks in advance to everyone
0

There are 0 best solutions below