---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: django-dev
  namespace: myblog-prod
spec:
  replicas: 1
  selector:
    matchLabels:
      name: django-dev  
  template:
    metadata:
      labels:
        name: django-dev  
    spec:
      hostname: django-dev
      containers:
      - name: db-server
        image: mysql:5.7
        env: 
        - name: MYSQL_DATABASE
          value: django
        - name: MYSQL_USER
          value: apiadmin
        - name: MYSQL_PASSWORD
          value: apiadmin_pwd
        - name: MYSQL_ROOT_PASSWORD
          value: root_pwd
        args:
        - --character-set-server=utf8mb4
        - --collation-server=utf8mb4_unicode_ci
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: db-volume
          mountPath: /var/lib/mysql
      - name: ap-server
        image: pshost01:5000/study/mydjango
        ports:
        - containerPort: 8000
          name: django-server
        - containerPort: 8888
          name: jupyter
        volumeMounts:
        - name: ap-volume
          mountPath: /opt
      volumes:
        - name: db-volume
          persistentVolumeClaim:
            claimName: django-dev-db
        - name: ap-volume
          persistentVolumeClaim:
            claimName: django-dev-ap