apiVersion: v1
kind: Service
metadata: 
  labels: 
    name: mysql
  name: mysql
spec: 
  ports:
    - port: 3306
  selector: 
    name: mysql
---
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels: 
    name: mysql
spec: 
  containers: 
    - resources:
        limits :
          cpu: 0.5
      image: mysql
      name: mysql
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: ${WP_PASSWORD}
      ports: 
        - containerPort: 3306
          name: mysql
      volumeMounts:
        - name: mysql-ephemeral-storage
          mountPath: /var/lib/mysql
      # we're alive when the socket opens
      livenessProbe:
        tcpSocket:
          port: "mysql"
        initialDelaySeconds: 5
        timeoutSeconds: 1
      # this may leak the password to logs
      readinessProbe:
        exec:
          command: ["mysqladmin", "status", "-p${WP_PASSWORD}"]
  volumes:
    # move a pod, lose your data
    - name: mysql-ephemeral-storage
      emptyDir: {}
