I am trying to deploy a Magento app but I am getting the following error. This cluster is created on EKS and PVC is there
persistentvolumeclaim "media" not found Error: failed to start container "magento-web": Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"/var/lib/kubelet/pods/8865b7dsdbd-721c-45f3-ab77-43a5f5da1362/volume-subpaths/nginx-config/magento-web/0\" to rootfs \"/var/lib/docker/overlay2/b1b3faa530b6sasas4ad6a9e62db641c5589fef3d29a9ab01f2db594652851a1814a6/merged\" at \"/var/lib/docker/overlay2/b1b3faa530b64ad6a9e62db641c5589fef3d29a9ab01fdsd2db594652851a1814a6/merged/etc/nginx/conf.d/default.conf\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Back-off restarting failed container
apiVersion: v1
kind: Service
metadata:
name: magento-web
namespace: magento
labels:
app: magento-web
k8s-app: magento
spec:
ports:
- name: "http"
port: 80
protocol: TCP
targetPort: 80
selector:
app: magento-web
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: magento-web
namespace: magento
labels:
app: magento-web
k8s-app: magento
spec:
selector:
matchLabels:
app: magento-web
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 30%
type: RollingUpdate
template:
metadata:
labels:
app: magento-web
k8s-app: magento
spec:
containers:
- image: nginx:mainline
imagePullPolicy: Always
name: magento-web
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
cpu: 10m
memory: 128Mi
requests:
cpu: 10m
memory: 128Mi
volumeMounts:
- mountPath: /etc/nginx/conf.d/default.conf
name: nginx-config
subPath: default.conf
- mountPath: /var/www/html/magento2.conf
name: nginx-config
subPath: magento2.conf
- name: media
mountPath: /var/www/html/pub/media
- mountPath: /var/www/html/pub/static
name: static
volumes:
- configMap:
defaultMode: 420
name: nginx
name: nginx-config
- name: media
persistentVolumeClaim:
claimName: media
- name: static
persistentVolumeClaim:
claimName: static
kubectl get pvc -n magento
volumes:
- configMap:
defaultMode: 420
name: nginx
name: nginx-config
- name: media
persistentVolumeClaim:
claimName: media
- name: static
persistentVolumeClaim:
claimName: static