0
votes

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

2
What have you done already? Is there a specific problem you're encountering? Can you include any relevant source code in the question itself? (Kubernetes doesn't have local-filesystem mounts in the same way as Docker does, so you'll need some other mechanism, depending on whether you're trying to inject configuration or do something else.)David Maze
You are basically asking someone to do all the work for you. Can you give it a try and show what you can accomplish? Then you can come and ask a specific question.Rico
Hi @Rico , I have updated the issue with my created kubernetes file.Kindly have a lookShikha Pandey

2 Answers

1
votes

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/

0
votes

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