Converting docker-compose to k8s manifest file

3/31/2021

I am working on a task to migrate all applications from docker container to kubernetes pods. I tried kompose but it's output is even further confusing. Can someone please help me out here? I have run out of options to try.

Here is how my docker-compose file looks like:

    version: '2'
    services:
      auth_module:
        build: .
        extra_hosts:
          - "dockerhost:172.21.0.1"
        networks:
          - default
          - mongo
        ports:
          - 3000
    networks:
      mongo:
        external:
          name: mongo_bridge_network

Kompose output:

    apiVersion: v1
    items:
    - apiVersion: apps/v1
      kind: Deployment
      metadata:
        annotations:
          kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe
            convert -f docker-compose.yml -o kubemanifest.yaml
          kompose.version: 1.21.0 (992df58d8)
        creationTimestamp: null
        labels:
          io.kompose.service: auth-module
        name: auth-module
      spec:
        replicas: 1
        selector:
          matchLabels:
            io.kompose.service: auth-module
        strategy: {}
        template:
          metadata:
            annotations:
              kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe
                convert -f docker-compose.yml -o kubemanifest.yaml
              kompose.version: 1.21.0 (992df58d8)
            creationTimestamp: null
            labels:
              io.kompose.network/mongo_bridge_network: "true"
              io.kompose.service: auth-module
          spec:
            containers:
            - image: auth-module
              imagePullPolicy: ""
              name: auth-module
              resources: {}
            restartPolicy: Always
            serviceAccountName: ""
            volumes: null
      status: {}
    - apiVersion: extensions/v1beta1
      kind: NetworkPolicy
      metadata:
        creationTimestamp: null
        name: mongo_bridge_network
      spec:
        ingress:
        - from:
          - podSelector:
              matchLabels:
                io.kompose.network/mongo_bridge_network: "true"
        podSelector:
          matchLabels:
            io.kompose.network/mongo_bridge_network: "true"
    kind: List
    metadata: {}
-- HobbyCoder
docker
docker-compose
kubernetes

0 Answers