apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress
      tier: frontend
  template:
    metadata:
      labels:
        app: wordpress
        tier: frontend
    spec:
      serviceAccountName: wordpress
      containers:
      - name: wordpress
        image: wordpress:5.2-apache
        env:
        - name: WORDPRESS_DB_HOST
          value: db-0.mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: wordpress
              key: wordpress-db-password
        ports:
        - name: wordpress
          containerPort: 80
        volumeMounts:
        - name: wp-uploads
          mountPath: /var/www/html/wp-content/uploads
      volumes:
      - name: wp-uploads
        persistentVolumeClaim:
          claimName: wp-uploads
