This is my PVC yaml file
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: do-block-storage
This is my deployment yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysite
labels:
tier: backend
spec:
replicas: 2
selector:
matchLabels:
app: mysite
tier: backend
strategy:
type: Recreate
template:
metadata:
labels:
app: mysite
tier: backend
spec:
containers:
- name: mysite
image: my-image
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /etc/nginx/sites-enabled
- name: my-pvc
mountPath: /var/www/app
volumes:
- name: my-pvc
persistentVolumeClaim:
claimName: my-pvc
- name: config
configMap:
name: wordpress-nginx-config
items:
- key: config
path: default.conf
imagePullSecrets:
- name: registry-secret
This is my wordpress config map
apiVersion: v1
kind: ConfigMap
metadata:
name: wordpress-nginx-config
labels:
tier: backend
data:
config: |
server {
listen 80;
index index.php index.html;
server_name _;
error_log /dev/stdout info;
access_log /dev/stdout;
root var/www/app;
location /.git {
deny all;
return 403;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|tiff|ttf|svg)$ {
expires 5d;
}
location ^~ /.well-known {
allow all;
auth_basic off;
}
}
Visiting my service URL, I still get error 404. I will appreciate every help I can get. I deployed without the PVC and it worked, I know the issue is with my PVC configuration.