apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: mysql
  labels:
    app.kubernetes.io/name: mysql
    app.kubernetes.io/part-of: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: mysql
      app.kubernetes.io/part-of: mysql
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mysql
        app.kubernetes.io/part-of: mysql
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsUser: 0
        fsGroup: 0
      containers:
      - name: mysql
        image: mysql:5.7
        imagePullPolicy: IfNotPresent
        args:
        - --basedir=/var/lib/mysql
        - --datadir=/var/lib/mysql/data
        - --character-set-server=utf8mb4
        - --collation-server=utf8mb4_unicode_ci
        env:
        - name: MYSQL_RANDOM_ROOT_PASSWORD
          value: "yes"
        - name: MYSQL_DATABASE
          value: wishlist
        - name: MYSQL_USER
          value: wishlist
        - name: MYSQL_PASSWORD
          value: wishlist
        ports:
        - containerPort: 3306
        volumeMounts:
        - name: data
          mountPath: /var/lib/mysql/
      volumes:
      - name: data
        emptyDir: {}
