Skills2026年4月16日·1 分钟阅读

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.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Kompose Compose-to-K8s
先审查命令
npx -y tokrepo@latest install 062f66b1-397e-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
Kompose converts Docker Compose files into Kubernetes Deployments, Services, and PersistentVolumeClaims with one command.
§01

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.

§02

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.

§03

How to use

  1. 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/
  1. Convert your Docker Compose file:
kompose convert
  1. Apply the generated manifests:
kubectl apply -f .
§04

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
§05

Related 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.

§06

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.

常见问题

Does Kompose support Docker Compose v3?+

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.

Can Kompose generate Helm charts?+

Yes. Use 'kompose convert -c' to generate a Helm chart directory instead of flat YAML manifests. This is useful for templated, reusable deployments.

What Kubernetes resources does Kompose create?+

Kompose generates Deployments, Services, PersistentVolumeClaims, and ConfigMaps by default. It maps Compose service ports to Services and volumes to PVCs.

Is Kompose an official Kubernetes project?+

Yes. Kompose is part of the Kubernetes project under the kubernetes GitHub organization. It is maintained by the Kubernetes community.

Can I customize the generated output?+

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.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产