Converting from docker-compose

Instructions on how to go from a docker-compose template to a Helm chart.

If you normally stand up your deployment or dev environment with docker-compose, you can convert your docker-compose.yaml file to a Helm chart using Kompose.

To install Kompose (assuming you are on macOS and have Homebrew installed):

brew install kompose

If you need instructions for a different platform or do not have access to Homebrew, please contact Metamanagement directly.

Once Kompose is installed, you need to add some labels to your docker-compose.yaml, so Kompose knows how to create your Kubernetes services. Under any service that is meant to be exposed to your users (i.e. as a web service), add kompose.service.type: nodeport and kompose.service.expose: "true":

services: 
  web-service:
    <...>:
    labels:
      kompose.service.type: nodeport
      kompose.service.expose: "true"

For more details on the types of labels that you can add and for more advanced configuration, please take a look at the Kompose User Guide.

To then convert docker-compose.yaml into a Helm Chart, you run:

kompose convert -c

By default, this will create your Helm Chart in a folder called docker-compose/. In docker-compose/Chart.yaml, you should update the name field to match whatever you want the name of the chart to be. You can then rename the docker-compose/ folder as you see fit.

Pointing at the right containers

Depending on how your docker-compose.yaml is set up, your newly created Helm Chart may not be pointing to a container registry where your images are hosted. To double-check, take a look at all of the files in <chart-folder>/templates/ of the form *-deployment.yaml, and search for the image: label. If the images specified are the ones in your cloud container registry, then all is well. To push your containers to the Google Cloud Registry, please see the following instructions.

Metamanagement recommends using Google Cloud Registry as GCR has a reasonable story for provisioning authentication credentials for use in all Kubernetes environments. If you must use a different container registry, please contact Metamanagement directly.

Last updated