apiVersion: v1
kind: Service
metadata:
  name: mivida
  namespace: mivida
  labels:
    app: mivida
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30089
      targetPort: mivida
  selector:
    app: mivida
    tier: frontend
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mv-pv-claim
  namespace: mivida
  labels:
    app: mivida
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ""
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mivida
  namespace: mivida
  labels:
    app: mivida
spec:
  selector:
    matchLabels:
      app: mivida
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mivida
        tier: frontend
    spec:
      containers:
      - image: docker-registry:32000/wordpress:1.0
        name: mivida
        env:
        - name: WORDPRESS_DB_HOST
          value: mivida-mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysqlmv-pass
              key: password
        - name: WORDPRESS_DB_USER
          valueFrom:
            secretKeyRef:
              name: mysqlmv-pass
              key: db_user
        ports:
        - containerPort: 80
          name: mivida
        volumeMounts:
        - name: mivida-persistent-storage
          mountPath: /var/www/html
      imagePullSecrets:
      - name: reg-cred-secret
      volumes:
      - name: mivida-persistent-storage
        persistentVolumeClaim:
          claimName: mv-pv-claim
