Docker & Kubernetes Vibe Code Cleanup
AI generated your Dockerfile and Kubernetes manifests. They work in dev. They'll break in production.
At Variant Systems, we pair the right technology with the right approach to ship products that work.
Why this combination
- AI-generated Dockerfiles use full base images and run as root by default
- Kubernetes manifests from AI lack resource limits, health checks, and security contexts
- Docker Compose configs from AI don't translate to production orchestration
- AI doesn't understand networking, volumes, or persistent storage in container environments
What AI Gets Wrong in Containers
AI generates Dockerfiles that work - and that’s the problem. They work well enough that nobody questions them until production reveals the issues. Full ubuntu:latest base images instead of alpine. No multi-stage builds, so build tools ship to production. COPY . . that invalidates every cache layer on any file change. Running as root because it’s simpler. No .dockerignore, so node_modules and .git end up in the image.
Kubernetes manifests from AI are template soup. Deployments without resource limits. Services without proper selectors. No health checks, so Kubernetes can’t tell when a pod is actually ready. No security contexts, so containers run with privileges they don’t need. The manifests deploy successfully and problems only appear under load, during updates, or when security scanning finally happens.
Our Container Cleanup Process
We start with the Dockerfile. Multi-stage builds separate build-time and runtime dependencies. The final image contains only the application binary and its runtime requirements. We switch to minimal base images - alpine, distroless, or scratch for compiled languages. Build order is restructured so dependency installation caches properly and only application code changes trigger rebuilds.
Kubernetes manifests get rewritten with production requirements. Resource requests based on profiled usage. Limits with appropriate headroom. Readiness probes that verify the application can serve traffic. Liveness probes that detect deadlocks. Security contexts that enforce non-root execution and read-only filesystems. Pod disruption budgets that maintain availability during node maintenance.
We set up the deployment pipeline so these standards are maintained. Image builds in CI with vulnerability scanning. Manifest linting that rejects configurations without required fields. Automated deployment to staging with promotion to production.
Before and After
Before: A 1.4GB Docker image that takes 3 minutes to pull. Pods that crash under load because there are no memory limits. Deployments that cause 30-second outages because there are no health checks. A docker-compose.yml that works on a laptop but has no production equivalent.
After: A 45MB image that pulls in seconds. Pods with appropriate resource limits that scale horizontally under load. Zero-downtime deployments with rolling updates and readiness gates. Kubernetes manifests in version control with automated deployment. The same application, running properly.
Persistent Storage and Volume Mistakes
AI-generated configurations routinely mishandle stateful workloads. We find emptyDir volumes used for data that must survive pod restarts, hostPath mounts that tie pods to specific nodes and break scheduling, and PersistentVolumeClaims with no StorageClass specified, defaulting to whatever the cluster provides. For databases or file storage running in Kubernetes, we configure appropriate PVC templates with the correct access modes, reclaim policies, and volume expansion settings. StatefulSets replace Deployments where stable network identity and ordered scaling matter. We also address backup strategies for persistent volumes, because a PVC without snapshots is one accidental deletion away from permanent data loss.
What you get
Ideal for
- Founders whose AI-generated Docker setup works locally but fails in production
- Applications with container images over 1GB that take minutes to pull
- Teams seeing pod crashes and restarts they can't explain
- Projects that need to move from docker-compose to proper orchestration