apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-mysql
  labels:
    app: myapp
    tier: mysql
spec:
  selector:
    matchLabels:
      app: myapp
      tier: mysql
  template:
    metadata:
      labels:
        app: myapp
        tier: mysql
    spec:
      containers:
      - image: mysql:5.7
        name: mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: secret
        - name: MYSQL_USER
          value: homestead
        - name: MYSQL_DATABASE
          value: homestead
        - name: MYSQL_PASSWORD
          # read the password from the ConfigMap
          # so we are sure laravel and MySQL use the same
          value: secret
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-pv-claim