Hi,
My configuration seems correct but the kubernetes service is always in pending. So the task is failed
This is the frontend confguration :
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
data:
nginx.conf: |
events {
}
http {
server {
listen 80 default_server;
listen [::]:80 default_server;
# Set nginx to serve files from the shared volume!
root /var/www/html;
index index.html index.htm index.php;
server_name _;
location / {
rewrite .* /index.php;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param REQUEST_METHOD \$request_method;
}
}
}
apiVersion: v1
kind: PersistentVolume
metadata:
name: nginx-pv
labels:
app: nginx-volume
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
storageClassName: standard
hostPath:
path: “/mnt/data”
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-pv-claim
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 2Gi
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: app
name: nginx-wp-dp
spec:
replicas: 1
selector:
matchLabels:
app: app
strategy:
type: Recreate
template:
metadata:
labels:
app: app
spec:
containers:
- name: nginx-container
image: nginx:latest
env:
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: mysql-db-url
key: database
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: mysql-user-pass
key: username
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-root-pass
key: password
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-user-pass
key: password
- name: MYSQL_HOST
valueFrom:
secretKeyRef:
name: mysql-host
key: host
volumeMounts:
- name: shared-files
mountPath: /var/www/html
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
ports:
- containerPort: 80
name: http
protocol: TCP
- name: php-fpm-container
image: wordpress:php7.2-fpm
env:
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: mysql-db-url
key: database
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: mysql-user-pass
key: username
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-root-pass
key: password
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-user-pass
key: password
- name: MYSQL_HOST
valueFrom:
secretKeyRef:
name: mysql-host
key: host
volumeMounts:
- name: shared-files
mountPath: /var/www/html
volumes:
- name: nginx-persistent-storage
persistentVolumeClaim:
claimName: nginx-pv-claim
- name: shared-files
emptyDir: {}
- name: nginx-config-volume
configMap:
name: nginx-config
apiVersion: v1
kind: Service
metadata:
name: nginx-service
labels:
app: app
spec:
ports:
- port: 80
targetPort: 80
nodePort: 30008
type: LoadBalancer
selector:
app: app
Please advice