Moving a working local docker-compose.yml to Kubernetes rarely succeeds with a blind one-to-one translation. Four differences cause most first-deploy CrashLoopBackOff failures.
1. depends_on Does Not Exist in Deployments
Compose lets you gate startup with depends_on + service_healthy. Kubernetes schedules pods independently. Make your application retry database connections on startup, or add an initContainer that checks TCP/readiness before the main container starts.
2. Bind Mounts Become Data Loss Traps
Translating ./pgdata:/var/lib/postgresql/data into a hostPath volume breaks the moment a pod reschedules onto another node. Move stateful services to PersistentVolumeClaim + StatefulSet.
3. Mixing Plain Config and Secrets in env_file
Compose stacks often lump LOG_LEVEL=info and DATABASE_URL=postgres://... into one .env file. Split non-sensitive values into a ConfigMap and credentials into a Secret (or External Secrets) before committing YAML to Git.
4. Service DNS and Pod/VPC CIDR Overlaps
Cross-namespace lookups need <service>.<namespace>.svc.cluster.local, and overlapping cluster pod CIDRs with existing AWS VPC or VPN subnets silently breaks egress routing.
Converting Private Compose Files Strictly in Browser Memory
Because production docker-compose.yml and .env files contain internal registry paths and secrets you shouldn't upload to random web converters, I built client-side utilities that run 100% locally (0 bytes uploaded):
- Docker Compose to Kubernetes Converter: https://global-utils.com/en/docker-to-k8s
- IPv4 CIDR Subnet Calculator: https://global-utils.com/en/cidr-calculator
-
.envSecret & Schema Inspector: https://global-utils.com/en/env-inspector
Top comments (0)