apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress-deployment
  template:
    metadata:
      labels:
        app: wordpress-deployment
    spec:
      containers:
      - name: wordpress-image
        image: wordpress:5.0-apache
        resources:
          requests:
            memory: "512Mi"
            cpu: "500m"
          limits:
            memory: "512Mi"
            cpu: "500m"
        ports:
        - containerPort: 80
        env:
          - name: WORDPRESS_DB_HOST
            value: mysql-deployment
          - name: WORDPRESS_DB_PASSWORD
            #value: wordpress-2020
            valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: password
        volumeMounts:
            - name: wordpress-volume
              mountPath: /var/www/html
      volumes:
        - name: wordpress-volume
          persistentVolumeClaim:
            claimName: wordpress-pvc