apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: mysql
  namespace: development
spec:
  selector:
    matchLabels:
      app: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - image: mysql:5.6
          name: mysql
          env:
            # Use secret in real usage
            - name: MYSQL_ROOT_PASSWORD
              value: root_pwd
            - name: MYSQL_USER
              value: myapp
            - name: MYSQL_PASSWORD
              value: myapp_pwd
            - name: MYSQL_DATABASE
              value: k8s_java
          ports:
            - containerPort: 3306
              name: mysql
