Writing a Kubernetes Deployment by hand means remembering the nesting of selectors, pod templates, probes, and resource blocks. This builder generates a correct, apply-ready manifest — plus an optional Service — from a few inputs.
How it works
A Deployment wraps a pod template. The top-level selector.matchLabels must
match template.metadata.labels, which is how the Deployment tracks its pods.
The container spec carries the image, ports, env vars, resource bounds, and
health probes:
resources:
requests: { cpu: 250m, memory: 256Mi }
limits: { cpu: 500m, memory: 512Mi }
livenessProbe:
httpGet: { path: /healthz, port: 8080 }
initialDelaySeconds: 10
readinessProbe:
httpGet: { path: /ready, port: 8080 }
CPU uses millicores (1000m = 1 core) and memory uses binary suffixes (Mi,
Gi). The readiness probe gates traffic; the liveness probe restarts a hung
container. The optional Service selects the same app label and exposes the
container port inside the cluster.
Tips and notes
Always set both requests and limits — without requests the scheduler can pack
pods badly, and without a memory limit a leak can starve the node. Keep
initialDelaySeconds long enough for slow-starting apps so the liveness probe
does not kill them during boot. Apply with kubectl apply -f deployment.yaml,
and use kubectl rollout status to watch the update.