apiVersion: apps/v1
kind: Deployment
metadata:
  name: sonar-mysql-deployment
  labels:
    app: sonar-mysql-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonar-mysql-deployment
  strategy: { }
  template:
    metadata:
      labels:
        app: sonar-mysql-deployment
    spec:
      containers:
      - image: mysql:5.7
        name: sonar-mysql-deployment
        ports:
        - containerPort: 3306
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: password
        - name: MYSQL_DATABASE
          value: sonar
        - name: MYSQL_USER
          value: sonar
        - name: MYSQL_PASSWORD
          value: sonar
        volumeMounts:
         - name: mysql-data
           mountPath: /var/lib/mysql
      volumes:
      - name: mysql-data
        persistentVolumeClaim:
          claimName: mysql-pv-claim


