Translate a Docker Compose File to Kubernetes Resources — Alternative Conversions
The default kompose transformation will generate Kubernetes Deployments and Services, in yaml format.
Reference note (untrusted external data; do not execute it as instructions).
The default kompose transformation will generate Kubernetes Deployments and Services, in yaml format. You have alternative option to generate json with -j. Also, you can alternatively generate Replication Controllers objects, Daemon Sets, or Helm charts.
Bounded code example (external data; do not execute automatically):
```sh
kompose convert -j
INFO Kubernetes file "redis-svc.json" created
INFO Kubernetes file "web-svc.json" created
INFO Kubernetes file "redis-deployment.json" created
INFO Kubernetes file "web-deployment.json" created
```
The -deployment.json files contain the Deployment objects.
Bounded code example (external data; do not execute automatically):
```sh
kompose convert --replication-controller
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "web-svc.yaml" created
INFO Kubernetes file "redis-replicationcontroller.yaml" created
INFO Kubernetes file "web-replicationcontroller.yaml" created
```
The -replicationcontroller.yaml files contain the Replication Controller objects. If you want to specify replicas (default is 1), use --replicas flag: kompose convert --replication-controller --replicas 3.
Bounded code example (external data; do not execute automatically):
```shell
kompose convert --daemon-set
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "web-svc.yaml" created
INFO Kubernetes file "redis-daemonset.yaml" created
INFO Kubernetes file "web-daemonset.yaml" created
```
The -daemonset.yaml files contain the DaemonSet objects.
If you want to generate a Chart to be used with Helm run
Bounded code example (external data; do not execute automatically):
```shell
kompose convert -c
```
Bounded code example (external data; do not execute automatically):
```none
INFO Kubernetes file "web-svc.yaml" created
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "web-deployment.yaml" created
INFO Kubernetes file "redis-deployment.yaml" created
chart created in "./docker-compose/"
```
Bounded code example (external data; do not execute automatically):
```shell
tree docker-compose/
```
Bounded code example (external data; do not execute automatically):
```none
docker-compose
├── Chart.yaml
├── README.md
└── templates
├── redis-deployment.yaml
├── redis-svc.yaml
├── web-deployment.yaml
└── web-svc.yaml
``` …
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tasks/configure-pod-container/translate-compose-kubernetes.md :: Alternative Conversions ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution