apiVersion: apps/v1 kind: Deployment metadata: name: recipes labels: app: recipes spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: recipes template: metadata: labels: app: recipes spec: restartPolicy: Always initContainers: containers: - name: recipes-nginx image: nginx:latest imagePullPolicy: IfNotPresent ports: - containerPort: 80 protocol: TCP name: http - containerPort: 8080 protocol: TCP name: gunicorn resources: requests: cpu: 250m memory: 64Mi volumeMounts: - mountPath: /media name: media # mount as subPath due to lost+found on ext4 pvc subPath: files - mountPath: /static name: static # mount as subPath due to lost+found on ext4 pvc subPath: files - name: nginx-config mountPath: /etc/nginx/nginx.conf subPath: nginx-config readOnly: true - name: recipes image: recipes imagePullPolicy: IfNotPresent command: - /opt/recipes/venv/bin/gunicorn - -b - :8080 - --access-logfile - "-" - --error-logfile - "-" - --log-level - INFO - recipes.wsgi livenessProbe: failureThreshold: 3 httpGet: path: / port: 8080 scheme: HTTP periodSeconds: 30 readinessProbe: httpGet: path: / port: 8080 scheme: HTTP periodSeconds: 30 resources: requests: cpu: 250m memory: 64Mi volumeMounts: - mountPath: /opt/recipes/mediafiles name: media # mount as subPath due to lost+found on ext4 pvc subPath: files - mountPath: /opt/recipes/staticfiles name: static # mount as subPath due to lost+found on ext4 pvc subPath: files env: - name: DEBUG value: "0" - name: ALLOWED_HOSTS value: '*' - name: SECRET_KEY valueFrom: secretKeyRef: name: recipes key: secret-key - name: GUNICORN_MEDIA value: "0" - name: DB_ENGINE value: django.db.backends.sqlite3 volumes: - name: media persistentVolumeClaim: claimName: recipes-media - name: static persistentVolumeClaim: claimName: recipes-static - name: nginx-config configMap: name: recipes-nginx-config