I have 2 containers in a pod. 1. Webapp 2. Nginx I would like to share the data from Webapp container /var/www/webapp/ with the nginx container. /var/www/html
/var/www/webapp ( folder structure )
│ index.php
│
│
└───folder1
│ │ service1.php
│ │
│ └───subfolder1
│ │ app.php
│
└───folder2
│ service2.php
The folder is mounted properly but all the files are missing.
apiVersion: apps/v1
kind: Deployment
spec:
volumes:
- name: webapp-data
persistentVolumeClaim:
claimName: webapp-data
containers:
- name: webapp
image: webapp
imagePullPolicy: Always
volumeMounts:
- name: webapp-data
mountPath: /var/www/webapp/
- name: nginx
imagePullPolicy: Always
image: nginx
volumeMounts:
- name: webapp-data
mountPath: /var/www/html/
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: webapp-data
spec:
storageClassName: local
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
When mounting a volume under docker all the folders and files from within the container are available but not in k8s.