apiVersion: v1
kind: Service
metadata:
  name: reevolution
  namespace: reevolution
  labels:
    app: reevolution
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30089
      targetPort: reevolution
  selector:
    app: reevolution
    tier: frontend
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: reevolution-pv-claim
  namespace: reevolution
  labels:
    app: reevolution
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: ""
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: reevolution
  namespace: reevolution
  labels:
    app: reevolution
spec:
  selector:
    matchLabels:
      app: reevolution
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: reevolution
        tier: frontend
    spec:
      containers:
      - image: wordpress:5.7.2-php7.4-apache
        name: reevolution
        env:
        - name: WORDPRESS_DB_HOST
          value: reevolution-mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: reevolution-pass
              key: password
        - name: WORDPRESS_DB_USER
          valueFrom:
            secretKeyRef:
              name: reevolution-pass
              key: db_user
        ports:
        - containerPort: 80
          name: reevolution
        volumeMounts:
        - name: reevolution-persistent-storage
          mountPath: /var/www/html
      volumes:
      - name: reevolution-persistent-storage
        persistentVolumeClaim:
          claimName: reevolution-pv-claim
