<p>I have project with docker-compose setup ready. Now I want to move to kubernetes. I use <a href="https://github.com/kubernetes/kompose" rel="nofollow noreferrer">Kompose</a> tool for converting from docker-compose to kubernetes.</p>

<p>For example, here is my sample <code>docker-compose.yml</code> file</p>

<pre><code>version: '3'
volumes:
  database_hades_volume:
    external: true
services:
  db:
    image: postgres:latest
    container_name: hades-db
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: hades_dev
      POSTGRES_PASSWORD: 1234
    volumes:
    - database_hades_volume:/var/lib/postgresql/data/
    tty: true
    stdin_open: true
  redis:
    container_name: hades-redis
    image: redis:latest
    ports:
      - "6379:6379"
  app:
    container_name: hades-app
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "4001:4001"
    volumes:
      - ".:/webapp"
    env_file:
      - ./.env.docker_compose-dev
    depends_on:
      - db
      - redis
</code></pre>

<p>I have run successfully by using command: <code>docker-compose up</code>. Now, I use <code>kompose</code> for converting to kubernetes by using command:</p>

<pre><code>kompose convert
</code></pre>

<p>Then I run by using:</p>

<pre><code>kompose up
</code></pre>

<p>Here is command line result information:</p>

<pre><code>INFO We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.

INFO Deploying application in "default" namespace
INFO Successfully created Service: app
INFO Successfully created Service: db
INFO Successfully created Service: redis
INFO Successfully created Deployment: app
INFO Successfully created PersistentVolumeClaim: app-claim0 of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work
INFO Successfully created Deployment: db
INFO Successfully created PersistentVolumeClaim: database-hades-volume of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work
INFO Successfully created Deployment: redis

Your application has been deployed to Kubernetes. You can run 'kubectl get deployment,svc,pods,pvc' for details.
</code></pre>

<p>But when I try to test by going to <code>localhost:4001</code> or <code>10.0.0.180:4001</code>, I see that it's waiting forever.</p>

<p>I don't know if I have setup something wrong or miss some steps. Please help me.</p>

<p>Thanks</p>

<p>Your docker-compose file contains <code>build</code> key which means you have source code/Dockerfile present for <code>app</code> service,
As of now,</p>

<pre><code>NAME                        READY     STATUS              RESTARTS   AGE
po/app-2119952459-b4jtb     0/1       ErrImagePull        0          24s
</code></pre>

<p>Status is <code>ErrImagePull</code> as cluster is not able to find any image, so along with <code>build</code> key, provide <code>image</code> key as well,
for ex.</p>

<pre><code>app:
  container_name: hades-app
  build:
    context: .
    dockerfile: Dockerfile
  image: &lt;username&gt;/&lt;imagename&gt;:&lt;tag&gt;
</code></pre>

<p>Because, now kompose has feature of local build and push support,
So kompose will build your image, push to dockerhub and then your cluster can pull image from there while deploying.</p>

<p>commands can be like, </p>

<pre><code>kompose up --build=local
</code></pre>

<p>I hope this makes sense</p>
