apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress
  labels:
    app: wordpress
    component: wordpress
spec:
  replicas: 2
  selector:
    matchLabels:
      app: wordpress
      component: wordpress
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: wordpress
        component: wordpress
    spec:
      containers:
      - image: wordpress:4.9-apache
        name: wordpress
        env:
        - name: WORDPRESS_DB_HOST
          value: mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql
              key: password
        ports:
        - containerPort: 80
          name: wordpress
        volumeMounts:
        - name: wordpress
          mountPath: /var/www/html
      volumes:
      - name: wordpress
        persistentVolumeClaim:
          claimName: wordpress
        