LinuxCommandLibrary

kompose

Convert Docker Compose to Kubernetes resources

TLDR

Deploy a dockerized application to Kubernetes

$ kompose up [[-f|--file]] [docker-compose.yml]
copy

Delete instantiated services/deployments from Kubernetes
$ kompose down [[-f|--file]] [docker-compose.yml]
copy

Convert a docker-compose file into Kubernetes resources file
$ kompose convert [[-f|--file]] [docker-compose.yml]
copy

SYNOPSIS

kompose [command] [flags]

PARAMETERS

convert
    Convert a Docker Compose file (docker-compose.yml) into Kubernetes resources.

-f, --file string
    Specify the Compose file to use. Defaults to docker-compose.yml.

--out string
    Specify the output directory for generated YAML files. Defaults to the current directory.

--chart
    Generate a Helm chart instead of YAML files.

--deployment-type string
    Specify the Kubernetes deployment type (deployment, daemonset, replicaset). Default is 'deployment'.

--build string
    Specify directory to use as a build context to build docker images.

--volumes string
    Specify how to handle volumes (emptyDir, hostPath, persistentVolumeClaim). Default is 'emptyDir'.

up
    Convert and deploy the application to Kubernetes (requires kubectl to be configured).

down
    Remove the converted application from Kubernetes.

version
    Display the Kompose version.

completion [bash|zsh|fish|powershell]
    Generate shell completion script

DESCRIPTION

Kompose is a conversion tool to go from Docker Compose to Kubernetes. Kompose takes a Docker Compose file as input and translates it into Kubernetes resource definitions such as Deployments, Services, and ConfigMaps. This allows users familiar with Docker Compose to easily deploy their applications on Kubernetes without needing to write Kubernetes YAML files from scratch.

Kompose aims to bridge the gap between Docker Compose and Kubernetes, simplifying the migration process for developers and making it easier to adopt Kubernetes for container orchestration. It's useful for local development, testing, and migrating existing Compose-based applications to Kubernetes. The tool can also be used as a learning aid, helping users understand how Compose concepts translate to Kubernetes resources.

CAVEATS

Kompose is not a perfect translator.
Some advanced Docker Compose features may not be fully supported or may require manual adjustments to the generated Kubernetes resources. It's important to review the generated YAML files and customize them as needed for your specific application requirements.

LIMITATIONS

While Kompose handles most common Docker Compose configurations, some advanced features like resource limits, health checks, and complex networking configurations may require manual intervention. Always thoroughly test the converted application in a Kubernetes environment.

EXAMPLES

Convert a docker-compose.yml file:
kompose convert
Convert and deploy to Kubernetes:
kompose up
Specify output directory:
kompose convert --out my-kubernetes-yamls

HISTORY

Kompose was initially created to simplify the process of deploying Docker Compose applications to Kubernetes. Its development has been driven by the need for a user-friendly tool that bridges the gap between these two container orchestration technologies. Over time, Kompose has evolved to support more features and options, making it a versatile tool for migrating and managing applications on Kubernetes.

SEE ALSO

Copied to clipboard