Generate Kubernetes YAML You Can Trust
July 31, 2026 · DevTools
Kubernetes YAML is not hard because the concepts are hard — it's hard because the format is unforgiving. One wrong indent, a Service selector that doesn't match the Pod labels, or a missing resources block, and kubectl apply either fails or silently does the wrong thing. The fastest way to reliable manifests is to generate the boilerplate and then edit the parts that matter.
Manifests: Deployment + Service + friends
The core of almost every stateless workload is a Deployment plus a Service. The two cross-references that catch people out are:
- Labels and selectors. The Service's
selectormust match the Pod template'slabels, or traffic never arrives. The Deployment'sselectormust match the same labels, or the Pods are orphaned. - Ports. The Service's
targetPortshould name the container port (e.g.http) or match its number.
The Kubernetes Manifest Generator keeps all of that in sync from a form. You set the app name, namespace, replicas, image, and container port; choose the Service type (ClusterIP, NodePort, LoadBalancer) and ports; add resource requests/limits and environment variables; and toggle a ConfigMap and Secret. It emits a multi-document YAML you can copy and kubectl apply -f directly:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app
image: nginx:1.27
ports:
- containerPort: 8080
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
Set resources. Without requests and limits a Pod can be evicted under pressure or starve its neighbors. The generator ships sane defaults you can edit.
If you enable a Secret, remember that the generated stringData values are plaintext in the YAML. Do not commit that output to a repository or paste real credentials into a shared terminal; use your platform's secret manager or an external-secrets workflow for production values.
Charts: parameterize, don't copy-paste
When the same workload runs across environments, copy-pasting manifests per environment rots fast. Helm solves this by templating manifests against a values.yaml. The hard part is the boilerplate: Chart.yaml, the _helpers.tpl naming functions, and wiring .Values into every template.
The Helm Chart Generator produces the whole scaffold — Chart.yaml, values.yaml, and templated Deployment, Service, Ingress, and _helpers.tpl. Set the chart metadata, image, and replica count, toggle an Ingress, and copy each file into the matching path. The generated helpers (fullname, labels, selectorLabels) keep names consistent across templates so you're not repeating yourself.
The rule that keeps a chart healthy: put environment-specific settings in values.yaml and read them through .Values, never hardcode them in a template. The generated scaffold currently places the optional Ingress host directly in its template, so move that host into values.yaml before reusing the chart across environments. Then helm install prod ./my-app -f prod.yaml and helm install staging ./my-app -f staging.yaml render the same templates with different values.
From generate to apply
Generate the manifests or chart, then review the YAML before you apply it — that's the point of generating readable, block-style output rather than opaque JSON. Apply to a dev cluster, watch the Pod reach Running, and confirm the Service routes traffic. When it's right, the same files go to production through your GitOps pipeline. Generate the boring parts, edit the interesting ones, and skip the indentation arguments entirely.