<p>I have created docker images using docker-compose.yml as below</p>

<pre><code>version: '2'

services:

  djangoapp:
    build: .
    volumes:
      - .:/sig_app
      - static_volume:/sig_app
    networks:
      - nginx_network

  nginx:
    image: nginx:1.13
    ports:
      - "80:80"
    volumes:
      - ./config/nginx/conf.d:/etc/nginx/conf.d
      - static_volume:/sig_app
    depends_on:
      - djangoapp
    networks:
      - nginx_network

networks:
  nginx_network:
    driver: bridge

volumes:
  static_volume:
</code></pre>

<p>I have used docker-compose build and docker-compose up. The three images are created as below </p>

<ol>
<li>kubernetes_djangoapp </li>
<li>docker.io/python</li>
<li>docker.io/nginx</li>
</ol>

<p>I want to deploy the application into kubernetes using YAML file.
I am new to kubernetes.
Django application is running with port 8000
and Nginx with port 80</p>

<p>This should work:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-deploy
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: my-app
    spec:
      volumes:
      - name: django-nginx
        emptyDir: {}
      - name: nginx-host
        hostPath:
          path: /config/nginx/conf.d 
      containers:
      - name: djangoapp
        image: kubernetes_djangoapp
        volumeMounts:
        - name: django-nginx
          mountPath: /sig_app
      - name: nginx
        image: nginx:1.13
        ports:
        - containerPort: 80
        volumeMounts:
        - name: django-nginx
          mountPath: /sig_app
        - name: nginx-host
          mountPath: /etc/nginx/conf.d
</code></pre>

<p>Note that you will have to modify some things to make it custom yours. I am missing where the image is. You should upload it to docker hub, or any registry of your choice.</p>

<p>About the volumes, here both containers share a non-persistent volume (django-nginx), which maps <code>/sig_app</code> directory in each container with each other. And another one that shares the container nginx (etc/nginx/conf.d) with your host (/config/nginx/conf.d), to pass the config file. A better way would be to use a ConfigMap. Check on that.</p>

<p>So, yeah, set the image for django and let me know if it doesn't work, and we will see whats failing.</p>

<p>Cheers</p>
