apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress
  labels:
    app: blog
spec:
  replicas: 1
  selector:
    matchLabels:
      name: wordpress
      tier: frontend
  template:
    metadata:
      labels:
        name: wordpress
        tier: frontend
    spec:
      containers:
      - name: wordpress
        image: wordpress:4.8-apache
        ports:
        - containerPort: 80
        env:
        - name: WORDPRESS_DB_HOST
          value: wordpress-mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: password
        volumeMounts:
        - name: wordpress-persistent-storage
          mountPath: /var/www/html
      volumes:
      - name: wordpress-persistent-storage
        persistentVolumeClaim:
          claimName: wp-pvc
