Kompose — Convert Docker Compose to Kubernetes
An official Kubernetes tool that translates Docker Compose files into Kubernetes Deployments, Services, and PersistentVolumeClaims in a single command.
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install 062f66b1-397e-11f1-9bc6-00163e2b0d79 --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
What it is
Kompose is an official Kubernetes tool that translates Docker Compose files into Kubernetes resource definitions. It generates Deployments, Services, PersistentVolumeClaims, and ConfigMaps from your existing docker-compose.yml, giving you a fast migration path from Compose to Kubernetes.
It targets DevOps engineers and developers migrating containerized applications from Docker Compose to Kubernetes who want to avoid manually writing YAML manifests.
How it saves time or tokens
Kompose automates the tedious translation of Compose service definitions into Kubernetes objects. A single command converts ports, volumes, environment variables, and dependencies into the correct Kubernetes resources. No manual YAML editing required.
How to use
- Install Kompose:
brew install kompose
# Or on Linux:
curl -L https://github.com/kubernetes/kompose/releases/latest/download/kompose-linux-amd64 -o kompose
chmod +x kompose && sudo mv kompose /usr/local/bin/
- Convert your Docker Compose file:
kompose convert
- Apply the generated manifests:
kubectl apply -f .
Example
# Install
brew install kompose
# Convert docker-compose.yml to Kubernetes YAML
kompose convert
# Or convert and apply directly
kompose up
# Generate Helm chart instead
kompose convert -c
# Specify output format
kompose convert -o k8s-manifests.yaml
Related on TokRepo
- AI Tools for DevOps — DevOps and infrastructure automation tools
- Featured Workflows — Discover trending DevOps tools on TokRepo
Key considerations
When evaluating Kompose for your workflow, consider the following factors. First, assess whether your team has the technical prerequisites to adopt this tool effectively. Second, evaluate the maintenance burden against the productivity gains. Third, check community activity and documentation quality to ensure long-term viability. Integration with your existing toolchain matters more than feature count alone. Start with a small pilot project before rolling out across the organization. Monitor resource usage during the initial adoption phase to identify bottlenecks early. Document your configuration decisions so team members can onboard independently.
Common pitfalls
- Not all Docker Compose features have Kubernetes equivalents;
depends_on,build, and some network modes are ignored or partially converted. - Volume mounts are converted to PVCs but may need manual storage class configuration for your cluster.
- Generated manifests are a starting point; production deployments need resource limits, health checks, and security contexts added manually.
Questions fréquentes
Yes. Kompose supports Compose file versions 1, 2, and 3. It reads the standard docker-compose.yml format and handles most service definitions across versions.
Yes. Use 'kompose convert -c' to generate a Helm chart directory instead of flat YAML manifests. This is useful for templated, reusable deployments.
Kompose generates Deployments, Services, PersistentVolumeClaims, and ConfigMaps by default. It maps Compose service ports to Services and volumes to PVCs.
Yes. Kompose is part of the Kubernetes project under the kubernetes GitHub organization. It is maintained by the Kubernetes community.
Yes. Kompose supports labels in your Compose file (kompose.service.type, kompose.volume.size) to control the generated Kubernetes resources. You can also post-process the YAML with kustomize or Helm.
Sources citées (3)
- Kompose GitHub— Official Kubernetes tool for Docker Compose conversion
- Kompose Official Site— Generates Deployments, Services, and PVCs from Compose files
- Kubernetes Documentation— Kubernetes project under the kubernetes GitHub organization
En lien sur TokRepo
Fil de discussion
Actifs similaires
Podman Compose — Run Docker Compose Files with Podman
Use existing docker-compose.yml files with Podman as the container engine, enabling rootless multi-container applications without the Docker daemon.
Docker Compose — Define and Run Multi-Container Applications
Docker Compose lets you define multi-container application stacks in a single YAML file and manage their full lifecycle with simple CLI commands.
Dockge — Fancy Self-Hosted Docker Compose Manager
Dockge is a reactive, self-hosted Docker Compose management UI from the creator of Uptime Kuma. It lets you create, edit, start, stop, and monitor docker-compose.yaml stacks through a beautiful real-time web interface.
Uncloud — Lightweight Container Orchestration Across Docker Hosts
A lightweight tool for deploying and managing containerized applications across a network of Docker hosts. Bridges the gap between Docker Compose and Kubernetes, providing multi-host orchestration without the complexity.