docker-compose.yaml file that you already
have. We will use a simple example containing an application connected to a PostgreSQL database.
compose.yml
Create a Helm chart from your Docker Compose
- Create a directory and set up the Helm Chart Directory Structure in it using the
helm create example-app-chartcommand. - Write a deployment object (Kubernetes manifest) for each of the services from the
docker-compose.yamlfile, in the templates directory. They define the desired state for application pods, ensuring that the specified number of replicas of the application is running at any given time.
templates/deployments.yaml
We can see that example-app service depends on the database service in the docker-compose file. The depends_on field
from Docker Compose, which defines dependencies between services, can be mimicked using initContainers in a Deployment
object. initContainers run to completion before the main application containers start. They can be used to ensure that
a dependent service is ready before starting the main application.
- Write a service object (kubernetes manifest) for each of the services from docker-compose.yaml file, in the templates directory, to expose the ports your services run on accordingly.
templates/services.yaml
The service.type field specifies how a service is exposed. Learn more about service types and their
values
- Create values.yaml file with appropriate values required by your helm chart
values.yaml
- Now that you’ve created a helm chart using your Docker Compose follow this guide to publish your helm chart and get it deployed in a Localops application environment.