How to convert docker compose yaml file to Kubernetes yaml file for Deployment?

6/23/2020

I would like to know how can I write this docker compose yml file of Grimoirelab into a Kubernetes yml file which can be deployed into the remote cluster.

Link to the docker compose file:

https://github.com/chaoss/grimoirelab/blob/master/docker-compose/docker-compose.yml

This is kubernetes file which i have created and i am facing issue with the last container :mordred as it is showing status as "error" in the pod with exit code 1 and terminated.

apiVersion: v1
kind: Pod
metadata:
  name: many-containers
spec:
  restartPolicy: Never
  containers:
  - name: mariadb
    image: mariadb:10.0
    env:
    - name: MYSQL_ALLOW_EMPTY_PASSWORD
      value: "yes"
    - name: MYSQL_ROOT_PASSWORD
   
  - name: hatstall
    image: grimoirelab/hatstall:latest
    env:
    - name: ADMIN_PASS
      value: admin
    - name: ADMIN_USER
      value: admin
    - name: DATABASE_DIR
      value: /db/
    volumeMounts:
    - name: hatstallfile1
      mountPath: /home/grimoirelab/apache-hatstall.conf
    - name: hatstallfile2
      mountPath: /home/grimoirelab/shdb.cfg


  - name: elasticsearch
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.6
    args:
    - elasticsearch
    - -Enetwork.bind_host=0.0.0.0
    - -Ehttp.max_content_length=2000mb
    env:
    - name: ANONYMOUS_USER
      value: "true"
    - name: ES_JAVA_OPTS
      value: -Xms2g -Xmx2g

  - name: kibiter
    image: bitergia/kibiter:community-v6.8.6-3
    env:
    - name: ELASTICSEARCH_URL
      value: http://elasticsearch:9200
    - name: NODE_OPTIONS
      value: --max-old-space-size=1000
    - name: PROJECT_NAME
      value: Demo


  - name: mordred
    image: bitergia/mordred:latest
    resources:
      limits:
        memory: "4294967296"
    volumeMounts:
    - name: setupfile
      mountPath: /home/bitergia/conf/setup.cfg
    - name: aliasesfile
      mountPath: /home/bitergia/conf/aliases.json 
    - name: orgfile
      mountPath: /home/bitergia/conf/organizations.json
    - name: identitiesfile
      mountPath: /home/bitergia/conf/identities.yml
         
  volumes:
  - name: setupfile
    hostPath:
      path: /setup.cfg
      
  - name: aliasesfile
    hostPath:
      path: /aliases.json
     
  - name: orgfile
    hostPath:
      path: /organizations.json
      
  - name: identitiesfile
    hostPath:
      path: /identities.yml
    
  - name: hatstallfile1
    hostPath:
      path: /apache-hatstall.conf
  - name: hatstallfile2
    hostPath:
      path: /shdb.cfg

Kindly answer me.From where does the volumes takes the host path?

As the issue I am facing is with the volumes and volume mount in Kubernetes. I am not understanding how should I mount them as I am a beginner in Kubernetes and docker.

Thanks

-- Shikha Pandey
docker
docker-compose
dockerfile
kubernetes
kubernetes-pod

2 Answers

7/1/2020

I have deployed individual deployment files for the image shown and it worked for me. Thank you all.It can be closed.

-- Shikha Pandey
Source: StackOverflow

6/24/2020

kompose is a tool to help users familiar with docker-compose move to Kubernetes. It takes a Docker Compose file and translates it into Kubernetes resources

follow the link --> https://kompose.io/getting-started/

-- P Ekambaram
Source: StackOverflow