apiVersion: apps/v1
kind: Deployment

metadata:
  name: mysql-test
  namespace: default

spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql-test
  template:
    metadata:
      labels:
        app: mysql-test
    spec:
      #nodeSelector:
      #  zone: memory
      containers:
      - name: mysql-test
        image: statemood/mysql:5.7.21
        imagePullPolicy: Always
        env:
        - name:  "MYSQL_CONFIG_FILE"
          value: "/var/lib/mysql/my.cnf"
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: data-mysql
        securityContext:
          privileged: true
          seLinuxOptions:
            user: system_u
            role: object_r
            type: fusefs_t
            level: "s0:c123,c456"
        ports:
        - containerPort: 3306
        resources:
          limits:
            cpu: "900m"
            memory: "3G"
          requests:
            cpu: "600m"
            memory: "2G"
          #volumes:
          ### Option 1: With hostPath
          #- name: data-mysql
            #hostPath:
            #  path: /opt/mysql/default
          ### Option 2: With Ceph-rbd ###
          #  persistentVolumeClaim:
          #    claimName: data-mysql-test