Docker Compose to Kubernetes Pod & Deployment Converter
Convert docker-compose.yml services into production-ready Kubernetes Deployments, Services, ConfigMaps, and PVCs online with breaking change analysis.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: api-data
labels:
app: api
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
labels:
app: api
spec:
replicas: 1
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: node:20-alpine
ports:
- containerPort: 3000
env:
- name: NODE_ENV
value: production
- name: DATABASE_URL
value: mysql://root:secret@db:3306/app
volumeMounts:
- name: api-data
mountPath: /app/data
volumes:
- name: api-data
persistentVolumeClaim:
claimName: api-data
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: api
labels:
app: api
spec:
selector:
app: api
ports:
- name: http
port: 3000
targetPort: 3000
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: api-config
labels:
app: api
data:
NODE_ENV: production
DATABASE_URL: mysql://root:secret@db:3306/app
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-data
labels:
app: db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: db
labels:
app: db
spec:
replicas: 1
selector:
matchLabels:
app: db
template:
metadata:
labels:
app: db
spec:
containers:
- name: db
image: mysql:8.0
ports:
- containerPort: 3306
env:
- name: MYSQL_DATABASE
value: app
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: MYSQL_ROOT_PASSWORD
volumeMounts:
- name: db-data
mountPath: /var/lib/mysql
volumes:
- name: db-data
persistentVolumeClaim:
claimName: db-data
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: db
labels:
app: db
spec:
selector:
app: db
ports:
- name: http
port: 3306
targetPort: 3306
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: db-config
labels:
app: db
data:
MYSQL_DATABASE: app
---
apiVersion: v1
kind: Secret
metadata:
name: db-secret
labels:
app: db
type: Opaque
stringData:
MYSQL_ROOT_PASSWORD: secretDetected Breaking Changes & Semantic Shifts (2)
Service "db" has sensitive env vars — generated Secret manifest. Replace values with actual secrets or use a secrets manager.
Host bind mounts cannot be directly mounted in cloud Kubernetes clusters without PersistentVolumes.
How to Migrate from Docker Compose to Kubernetes Manifests
- 1
Paste your existing docker-compose.yml file into the editor.
- 2
The migrator scans service declarations, environment variables, ports, and volume mounts.
- 3
Review any breaking storage and networking warnings raised by Kubernetes cluster constraints.
- 4
Export the generated Kubernetes Deployments, Services, and ConfigMaps as YAML.
Validate K8s Manifests in CI
name: Validate Kubernetes
on: [push, pull_request]
jobs:
kube-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run kubeconform
run: |
curl -sL https://github.com/yannh/kubeconform/releases/latest/download/kubeconform-linux-amd64.tar.gz | tar -xz
./kubeconform -summary k8s/
Run Migration via Terminal CLI
Perform identical migration routines across entire directories or repositories in your local terminal:
devflow migrate docker-compose-to-k8s -i docker-compose.yml -o k8s/Related DevOps & Stack Migrators
Migrate GitHub Actions Workflows to GitLab CI
Translate GitHub Actions YAML workflows into robust .gitlab-ci.yml pipelines with stages, container images, caching, and artifacts.
Migrate npm package.json to Bun Runtime & Scripts
Instantly migrate npm scripts, dependencies, and configurations to Bun. Optimize script execution speeds and strip obsolete transpilations.
Associated DevFlow Tools
Kubernetes YAML Validator
Validate, lint, and format Kubernetes manifests against structure rules, deprecated APIs, and security best practices.
Dockerfile Linter
Lint, validate, format, and optimize Dockerfiles with Hadolint-compatible rules, security checks, and multi-stage analysis.
YAML Converter
Convert between JSON and YAML with validation, formatting, and multi-document support.
Frequently Asked Questions
- Does this generator support Docker Compose v2 and v3 syntax?
- Yes, both version 2 and version 3 compose specs are parsed, translating services, ports, environment variables, and replicas into valid K8s apps/v1 Deployments.
- How are multi-container services converted?
- Each compose service is translated into an independent Kubernetes Deployment accompanied by a ClusterIP Service for internal networking.