Migrate from Docker Compose to Kubernetes

Moving a Docker Compose application to Kubernetes is a rewrite of networking, storage and secrets, not a file conversion. This page explains what Kompose converts, what it ignores and how to plan the cutover.

On this page

How hard is it to migrate from Docker Compose to Kubernetes?

The effort depends less on the Compose file itself than on what the Compose file quietly depends on. Moving a Compose application to Kubernetes is a rewrite of networking, volumes, secrets and configuration, and the amount of work scales with the number of services and the number of stateful dependencies such as databases, queues and file stores. A team with a handful of stateless services on a single host can often finish in a short project. A team with a dozen services, shared bind mounts, hand-managed .env files and a database on the same host is planning a platform change, not a file conversion. Teams usually need Kubernetes for one of three reasons: they need to scale beyond one host, they need consistent policy across environments, or they need a shared platform that other teams can deploy onto. Name the reason first, because it decides which parts of the Compose setup must be redesigned and which can be carried over as they are.

Kompose is a useful starting point, but it does not produce a deployable result. It converts services into Deployments and Services and some volumes into PersistentVolumeClaims, and it ignores or only partly handles several Compose behaviors that matter in production, including depends_on ordering, health checks, network_mode, secrets handling, and build steps. Treat its output as a draft to review line by line. Before anyone estimates the work, build a written inventory for each service: image source, ports, every network it joins, every volume and bind mount with its data owner, every secret and how it is injected, resource limits, restart behavior and external hosts it calls. Confirm the inventory against the running hosts, not only the repository, because undocumented host paths and manual changes are the most common source of surprises. The inventory is also the input a partner needs to scope a fixed-price engagement, and it is the basis for a Helm chart structure that your team can maintain after the project ends.

Which Compose features map to Kubernetes and which need redesign

This table pairs each Docker Compose feature with its closest Kubernetes object and flags where the move needs an explicit design decision rather than a direct translation. Read the middle column as the starting point for conversion and the last column as the work a team must decide before cutover.

Compose featureKubernetes equivalentDesign decision needed
services (image, command, environment)Deployment with a Pod template, container image and argsChoose replica count, rollout strategy and image tag pinning for each service
networks and service name DNSService (ClusterIP) resolved through cluster DNSDecide which services need network isolation and whether NetworkPolicy objects will enforce it
published ports (ports: host mapping)Service of type ClusterIP, NodePort or LoadBalancerHost port mappings have no direct equivalent. Choose how external traffic reaches each service
HTTP routing for published web servicesIngress or Gateway API HTTPRouteSelect the controller and confirm which annotations or features the chosen implementation supports
named volumesPersistentVolumeClaim bound to a StorageClassConfirm the storage class, access mode, size and backup approach with the platform owner
bind mounts of host pathshostPath volume or ConfigMap, depending on contenthostPath ties pods to specific nodes and is usually a security concern. Move content into images, ConfigMaps or PVCs where possible
env_file and environment valuesConfigMap for non-sensitive settings, injected through envFrom or envSeparate settings from credentials so ConfigMaps hold no secrets
Docker secrets (secrets: file mounts)Secret mounted as a volume or environment variableSecrets are stored unencrypted in etcd by default. Confirm encryption at rest or an external store before go-live
depends_on with conditionNo direct equivalent. Use readiness probes and init containersDecide which startup order is essential and encode it as init containers or retry logic in the application
healthchecklivenessProbe and readinessProbeSplit the check into liveness and readiness, since a failing readiness probe removes a pod from Service endpoints
restart: policyrestartPolicy on Pods, controlled by the owning workloadDeployments always restart pods. Jobs and CronJobs need an explicit restartPolicy choice
build sectionNo runtime equivalent. Build in CI and push images to a registrySet up a private registry that the cluster can pull from, especially in networks without internet access

What Kompose converts, what it ignores and what you check by hand

Kompose gives you a starting point, not a finished deployment. The cards below separate what the converter handles from what it skips or warns about, and they show where your team has to make decisions by hand before anything reaches a cluster.

What Kompose is for

Kompose is the converter documented for turning a Compose file into Kubernetes manifests or a Helm chart. It maps services to Deployments and Services and creates resources for ports and some volumes. Treat its output as a draft: it reproduces the shape of your Compose file, not the operational design a production cluster needs. Confirm the Kompose version you run and the list of supported Compose keys in the project documentation before you rely on any generated file.

Build directives and image sources

Compose build entries point at local Dockerfiles, and Kompose does not build images for the cluster. Your pipeline must build, scan and push each image to a registry the nodes can pull from, then the manifests must reference that tag. Check that generated image fields carry a pinned tag or digest rather than latest, and that imagePullSecrets exist in each namespace where pods run.

Startup order from depends_on

Compose depends_on controls start order on a single host, but Kubernetes does not honor it. Kompose will not reproduce the ordering guarantee, so services that need a database to be ready must handle retries or use readiness probes and init containers. Review each dependent service and decide how it recovers when its upstream is unavailable during a rolling update or node drain.

Volumes and persistent data

Named volumes and bind mounts in Compose behave differently from PersistentVolumeClaims. Bind mounts to host paths do not carry over safely across nodes, and the storage class chosen by default may not match the data's performance or backup needs. Decide for each volume whether it becomes a PVC, a ConfigMap or a managed database, and confirm the access mode and reclaim policy with your storage team before the first deployment.

Secrets and environment values

Compose files often hold passwords in plain environment entries or in .env files that Kompose converts into objects that look like Secrets. Kubernetes Secrets are stored unencrypted in etcd by default, so a direct conversion can move a weak practice into the cluster. Replace literal values with references to an external secret store where possible, enable encryption at rest, and keep the generated Secret manifests out of Git.

Secrets good practices

Validating generated output before apply

Generated manifests must pass the same checks as hand-written ones. Run kubectl apply --dry-run=server against the target cluster so the API server validates each object and admission controllers run, then use kubectl diff to review changes against live state. Lint the Helm chart with helm lint and render it with helm template before any install. Record the Kompose version and command options so the conversion can be repeated and reviewed.

How the Compose to Kubernetes cutover runs in phases

The sequence takes a Compose application from inventory to a Kubernetes deployment that has been run alongside the original, cut over with a rollback path, and finally retired from Compose hosts. Each phase produces a checked artifact before the next one starts.

  1. Inventory services, data and external dependencies

    List every Compose service, its image and build context, published ports, volumes, environment files, secrets, health checks, and the external systems it calls or receives calls from, such as databases, queues, SMTP relays and identity providers. Record which services hold state and which are stateless. The output is a dependency map and a signed-off list of what moves in this cutover, reviewed by the application owner and the team that runs the Compose hosts today. Ask the application owner to confirm which dependencies are undocumented, since those are the usual source of surprises later.

  2. Build images into a registry the cluster can reach

    Move every service image into a container registry that the Kubernetes nodes can pull from, and pin each image to an immutable tag or digest rather than a floating tag like latest. Where the cluster has no direct internet access, mirror the images into a private registry first. Confirm that the cluster's pull credentials work from every node. The check that closes this step is a pull test on each node for each image, run with the same credentials the workloads will use.

  3. Convert one pilot service with Kompose and rewrite the output

    Choose a stateless, low-risk service as the pilot and run Kompose against its Compose file to generate a first set of manifests. Review every generated object, because Kompose converts the common cases but does not carry over everything Compose does, and it leaves some settings for hand correction. Rewrite the output for Kubernetes conventions: Deployments with resource requests and limits, readiness and liveness probes, Services for internal addressing, and Ingress or Gateway API resources for external access. Store the reviewed manifests in version control. The output is a pilot service that passes a deployment in a non-production namespace and answers its health endpoint.

  4. Rewrite networking, volumes and secrets for the cluster

    Replace Compose networks and service-name DNS with Kubernetes Services and namespace-scoped names, and replace bind mounts and named volumes with PersistentVolumeClaims backed by a StorageClass chosen for the workload. Move environment values that hold credentials into Kubernetes Secrets, and decide how those Secrets are protected at rest and who can read them, following the cluster's encryption and RBAC settings. Do not commit Secret values to the repository. The check for this step is that each service reaches its dependencies through the new names, that stateful data survives a pod restart, and that no credential appears in a manifest or chart values file.

  5. Package the application as Helm charts with per-environment values

    Turn the reviewed manifests into one Helm chart per application, with templates for the workload objects and a values file that holds the settings differing between environments, such as image tags, replica counts, hostnames, storage sizes and references to externally managed Secrets. Keep environment values in separate files, and render each chart with helm template before deploying it. The output is a chart that installs and upgrades cleanly in a test environment from the same versioned source used in production, with the chart version recorded alongside the application version.

  6. Run Compose and Kubernetes in parallel and validate

    Keep the Compose deployment serving production while the Kubernetes release receives copies of realistic traffic, shadow requests, or a small share of users, depending on what the application allows. For data-bearing services, compare outputs from both sides, reconcile records written during the overlap, and confirm that writes are not duplicated by two active writers. Define in advance the metrics and error rates that must hold before cutover, and agree who signs off. The step closes when the comparison report shows the agreed criteria were met for the whole overlap window.

  7. Cut over traffic with a tested rollback path

    Move traffic to the Kubernetes release at a point agreed with the application owner, with DNS, load balancer or gateway changes prepared and reviewed beforehand. Keep the Compose stack running and its data path intact so that traffic can be pointed back quickly, and rehearse that rollback before the cutover. For databases or any service with a single writer, document the exact order of switching writes and who can authorize a reversal. The output is a cutover record showing the time traffic moved, the validation checks run afterward, and a confirmed rollback test.

  8. Decommission Compose hosts after a stability window

    Once the Kubernetes deployment has run in production through an agreed stability window, stop the Compose services and take a final backup of their volumes and configuration. Remove the hosts from monitoring, backup schedules and access lists only after the backup is verified by a restore test. Keep the Compose files and final backup archived for an agreed retention period. The closing check is a written decommission record that lists each host, the backup location, the restore test result and who approved removal.

Rewriting networking, volumes and secrets for the cluster

Compose gives every service a network identity for free: containers on the same project network resolve each other by service name, published ports map straight to the host, and .env files or inline environment entries carry configuration. Kubernetes replaces each of these with its own mechanism, and the rewrite is where most converted manifests need hand work. Each Compose service that other services call becomes a ClusterIP Service, and the calling code keeps its hostname because Kubernetes DNS resolves Service names inside the namespace. Ports that were published for outside users move to a Service of type LoadBalancer or to an ingress or Gateway API implementation that the team has selected and installed, and the routing rules for host names and paths must be written again in that resource. Confirm which controller will own those routes before anything is cut over, because Kompose output does not choose one for you.

Storage needs an explicit decision for each volume. A named Compose volume becomes a PersistentVolumeClaim, and the claim is satisfied by a StorageClass the team has chosen and tested for the workload's access mode and performance needs. A bind mount of a host path does not carry over safely, since pods are scheduled across nodes and the path may not exist on the node that receives them. Teams should replace bind mounts with ConfigMaps for configuration files, with claims for data, or with a deliberate hostPath exception that security reviewers can see and approve. Ask the storage platform owner which StorageClasses exist, whether they support the access modes the application needs, and how snapshots and restores work, because those answers determine whether a database volume can be migrated with data intact.

Secrets need the most care. Compose usually stores passwords in .env files or plain environment variables, and a direct conversion moves them into Kubernetes Secret objects that are stored unencrypted in etcd by default. Before loading production values, the platform team should enable encryption at rest for Secrets in the API server configuration, restrict get, list and watch access with least-privilege RBAC roles, and avoid mounting one broad service account into every namespace. Where the organization already runs an external secrets store, the Secrets Store CSI Driver can mount values from that store into pods without keeping a long-lived copy in the cluster. Choose the model before conversion, because moving secrets twice creates a second cleanup task.

Questions teams ask before migrating Compose to Kubernetes

How much effort does a Docker Compose to Kubernetes migration take?

Effort depends mostly on how many services the Compose file defines, how many of them keep state, and how much of the networking and configuration relies on Compose-specific behavior. A stateless web app with one database is a small exercise. A stack with message queues, shared volumes, bind mounts and secrets passed as environment variables touches every Kubernetes primitive that matters. Kompose output is a starting point, so the real effort is the rewrite: Services, Ingress or Gateway API routes, PersistentVolumeClaims, Secrets, probes, resource requests and a Helm chart that deploys the result the same way in every environment. Ask any provider to break the quote down by service, by stateful component and by packaging work, and to state which of those items assume your existing images and CI pipeline are reusable.

How long does the migration take, and what changes the schedule?

The schedule is driven by the number of services, the count of stateful components, the number of external integrations, and how much environment parity you need between staging and production. Teams usually underestimate the parallel-run period, when Compose and Kubernetes serve the same traffic or data so that cutover can be rolled back. Other schedule drivers include access approvals for the target cluster, whether an identity provider and TLS certificates already exist, and whether the cluster is already built. The cluster itself has its own lifecycle: Kubernetes ships about three minor releases per year on a cycle of about 14 weeks, so the target version you pick affects both the timeline and the upgrades you will need later. Request a milestone plan with named gates such as images built, chart installed in staging, data cut over and production traffic moved.

What does the migration need from our internal team?

The work needs people who know the application, people who own the target infrastructure, and someone who can approve changes to data. Application owners must confirm which environment variables are configuration, which are secrets, how the app behaves when a dependency restarts, and which files it writes to disk. Platform owners must provide the cluster, a container registry the cluster can reach, DNS, certificates, storage classes and network rules. Security owners should review how secrets are stored, since Kubernetes Secrets are stored unencrypted in etcd by default unless encryption at rest is configured. Plan for named reviewers with time in the schedule, not just the build team.

Can our team migrate Compose applications without outside help?

A team with working Kubernetes experience can migrate simple stacks alone, especially when the applications are stateless and the team already runs a cluster and a GitOps or Helm workflow. Outside help is most useful where the stack has stateful services, strict network or identity requirements, or compliance evidence to produce, and where the team has not yet operated the cluster in production. Ask yourself whether someone on the team can explain Pod Security Admission, RBAC, persistent volume reclaim behavior and rolling update failure modes, and whether there is time to own the result after handover. DeployOpen implements, documents and supports self-hosted platforms in your own infrastructure, so the choice between building in-house and engaging a partner is a question of capacity and skill, and a written scope makes that comparison concrete.

Can Kompose output go straight to production?

No. Kompose converts Compose services into Kubernetes manifests, which is useful for a first draft, but its output is not a production configuration. It reproduces some concepts directly, such as Deployments and Services, and it skips or approximates others, so each Compose feature needs a review. Typical gaps include health checks that need Kubernetes probes, named volumes that need explicit PersistentVolumeClaims, environment files that should become Secrets or ConfigMaps, restart and dependency behavior, resource limits, and network modes that have no direct equivalent. The generated manifests also carry no security settings, so pod security context, image pinning and Pod Security Standards need to be applied deliberately. Treat Kompose as a checklist generator and verify the output with the team that owns each service.

How are stateful services such as databases handled?

Databases and other stateful services should not be moved by converting a Compose volume into a pod and hoping for the best. The decision is whether to run the database on Kubernetes through a maintained operator, run it on dedicated servers or a managed service in your infrastructure, or keep the existing instance and connect to it. Each option changes backup, restore, upgrade and failover work. Ask how persistent storage will be provided, which StorageClass and CSI driver will back it, how snapshots and backups are tested, and how data is copied from the Compose volume without losing writes. Pick a cutover method that allows rollback. The PostgreSQL and Kafka pages in this library cover those services in more depth.

How does Helm packaging fit into the migrated application?

Helm packages the rewritten manifests as a chart with templates and a values file, so the same release can deploy to staging and production with different settings for image tags, hostnames, storage sizes and replicas. Keep secrets out of values files committed to source control, and reference them from an external store or a sealed mechanism agreed with your security team. Define the chart so that upgrades are predictable: pin chart and image versions, document the values that differ per environment, and test upgrades and rollbacks in staging before production. Ask the provider what the chart includes, how it is versioned, who receives the source and documentation, and what handover covers.

What usually goes wrong in a Compose to Kubernetes move

Most failed Compose migrations break in the same few places: data, credentials, health, resources, startup order and image access. Each risk below is easy to miss because Compose hid it, and each has a specific check to run before traffic moves.

Stateful data copied without a tested restore

Compose volumes are bind mounts or named volumes on one host, so copying files into a PersistentVolumeClaim often looks finished when the database is not consistent. Stop writes or use the database's own dump tool, then restore into the new cluster and run real queries against it. Confirm the StorageClass and reclaim policy before the first load, because a deleted claim can take the data with it.

Secrets left in plain manifests

Compose files often hold passwords in environment blocks, and the conversion carries them into ConfigMaps, Helm values files or Git. Kubernetes Secrets are stored unencrypted in etcd by default, so move values into Secrets, enable encryption at rest, and restrict list and watch access with least-privilege RBAC. Use an external store through the Secrets Store CSI Driver where your policy requires it.

Secrets good practices

Missing health checks during rollouts

Compose's depends_on and healthcheck settings do not translate automatically, so pods can receive traffic before the application can serve it. Define readiness probes that test the real endpoint, and liveness probes that do not restart a slow but healthy service. Without readiness, a rolling update sends requests to pods that have not finished starting.

Resource requests left unset

Compose containers run with whatever the host allows, while pods without requests and limits are scheduled blindly and are the first evicted when a node runs short of memory. Measure actual usage under load, set requests close to that baseline, and set memory limits deliberately for Java or Node workloads. Confirm the namespace quota and LimitRange match the numbers before go-live.

Startup order assumptions broken by scheduling

Compose starts services in a declared order on one host, but Kubernetes schedules pods across nodes with no guaranteed sequence. A web app that starts before its database or migration job can crash-loop or write to a half-ready schema. Replace ordering with readiness checks, retry logic in clients, and a migration Job that runs to completion before the application Deployment rolls out.

Images pulled from unreachable registries

A Compose host may pull images from a public registry or a developer's local build cache, while cluster nodes in a restricted network cannot. Mirror every image into a registry the cluster can reach, pin tags or digests instead of latest, and test an image pull from a worker node before cutover. Clusters without internet access need the images loaded in advance, using a private registry.

Packaging the result as a Helm chart

Packaging the converted manifests as a Helm chart turns a one-off conversion into something your team can install, upgrade and review the same way in every environment. The main design decision is which values the chart exposes. Image tags, public hostnames, storage class names and references to existing Secrets should be values, because those are the settings that change between development, test and production. Container commands, internal Service names, port numbers and probe paths should stay in templates, because changing them per environment usually signals a design problem in the application rather than a configuration need. Keep the values file for each environment short and explicit, and avoid copying the whole default file. Secrets deserve special care: the chart should reference Secrets created outside it (by name and key) rather than rendering credentials from values, so plaintext passwords do not end up in Git history or in Helm release storage. Confirm the chart conventions, the Chart.yaml fields and the templating functions against the current Helm documentation before you start, because these have changed across Helm releases.

Environments then differ only in their values files, and a review of a release should be a diff of those files plus the chart version. Keep one chart in version control and one values file per environment, and render each one with the helm template command before any install so reviewers can read the manifests that would reach the cluster. Version the chart in Chart.yaml using semantic versioning, bump the chart version whenever templates or defaults change, and bump the application version separately when the image changes. Testing should run in layers: lint the chart with helm lint, render it for every environment, validate the output against the Kubernetes API version your cluster serves, and run an install and upgrade test in a disposable namespace. Helm's own test hooks can check that Services answer after deployment. Ask your team to confirm the tooling versions used in the pipeline, including Helm and any schema validator, because version drift between a developer laptop and the CI runner is a common cause of inconsistent renders.

How Compose services move onto cluster components

The diagram starts with the Compose file, which Kompose converts into a first draft of Kubernetes manifests. Engineers then rewrite networking, volumes and secrets by hand, because those are the parts a converter cannot judge. The result is packaged as a Helm chart and run next to the Compose stack until traffic and data checks agree, and only then is Compose retired.

Compose services move through manual rewrites and Helm packaging before cutover.

What drives the cost and duration of the move

The effort to move a Compose application onto Kubernetes depends less on the YAML conversion than on what surrounds it. Six drivers shape the quote and the calendar, and most of them are visible before any manifest is written. Ask for each one to be sized in the written scope.

Service count and dependencies

Each Compose service becomes a set of Kubernetes objects, and every depends_on relationship, shared network and healthcheck needs a deliberate replacement. An application with a few stateless services and one database is a different job from one with a dozen interdependent containers. Ask the partner to map the service graph and list which dependencies are ordering, which are network reachability and which are startup health. This is a one-time cost, but it grows with every service you add later.

Stateful services and data volume

Named volumes, bind mounts and databases in Compose need a storage design: StorageClasses, PersistentVolumeClaims, backup jobs and a restore test. Moving a stateful service with a large dataset usually costs more than moving the stateless ones, because data copy, cutover and rollback have to be planned together. Ask how each volume will be migrated, how long a final sync takes at your data size and who owns the backup schedule afterward. Backups recur, so ask for their operating cost.

Secrets and external integrations

Compose files often hold credentials in environment variables, .env files or mounted files that move into Secrets, and every external system the application calls needs an egress path and an identity. Kubernetes Secrets are stored unencrypted in etcd by default, so the design may include encryption at rest or an external store, which adds setup work. Ask which secrets are in scope, where they will be sourced from and who rotates them. Rotation is recurring work.

Secrets good practices

Build pipeline and registry readiness

Compose frequently builds images from local Dockerfiles or pulls tags that were never pinned. Moving to Kubernetes requires images in a registry the cluster can reach, versioned tags, a CI pipeline that builds and pushes them and, in clusters without internet access, a private registry mirror for every base image. If the pipeline does not exist, that becomes a separate workstream. Ask what already builds images, where they are stored and whether the cluster can pull them. Pipeline maintenance recurs.

Parallel-run validation

Running the Compose stack and the Kubernetes release side by side for a period is the most reliable way to confirm behavior, and it also doubles hosting cost during that window. Validation effort depends on how many user journeys, scheduled jobs and integrations must be compared, and on whether traffic can be split safely. Ask how the parallel run will be scoped, what success criteria will be measured and how long the old stack stays available for rollback. This is one-time effort, but the duplicated infrastructure is a cost you carry during it.

Internal Kubernetes skills

A team that already operates clusters can review manifests, own Helm values and handle day-two incidents. A team without that experience will need training or ongoing support for upgrades, certificate renewal, resource settings and troubleshooting after handover. Ask the partner which knowledge transfer is included, whether runbooks are delivered and what support is available after the move. Operational support recurs for as long as the cluster runs, so this driver affects total cost of ownership more than the migration itself.

How DeployOpen scopes and delivers a Compose to Kubernetes migration

DeployOpen plans, implements, documents and hands over self-hosted open-source platforms inside your own infrastructure, including the move from Docker Compose to Kubernetes. Each engagement starts from a written scope that names the services, the target cluster and the Helm charts you will own afterward.

How we scope

  • Inventory every Compose file, service, image tag, volume and environment variable before estimating any work.
  • Agree in writing which services move, which stay on Compose and which are retired.
  • Confirm the target cluster, its distribution, identity integration and storage classes before the build begins.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we build

  • Run Kompose output as a starting point, then rewrite networking, volumes and secrets by hand.
  • Replace Compose secrets and plain environment values with Kubernetes Secrets or an external store you approve.
  • Package the result as Helm charts with values files for each environment you operate.
  • Test each service against the target cluster in a non-production namespace before any cutover.

How we hand over

  • Deliver Helm charts, values files and a runbook that describes install, upgrade and rollback steps.
  • Document each change from Compose behavior, including ports, health checks, restart policies and volume mounts.
  • Provide a cutover plan with a rollback path and the checks your team runs to confirm service health.
  • Walk your engineers through the chart structure so your team can maintain the charts after handover.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover.
  • Plan chart updates alongside Kubernetes minor version upgrades, which the project supports for a limited window.
  • Keep a record of Compose-era assumptions that the cluster does not reproduce, so reviews stay accurate.
  • Ask for a quote that lists each service, its chart work and its testing so you can compare it with your own team's effort.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.