Most charts in the wild quietly skip the things that matter most in production: schema validation, sane HPA behavior, topology spread, security context, and rollout safety.
This is a complete chart for a backend API, with the reasoning for each choice. The code blocks are copy-pasteable.
What you get at the end
A chart you can actually trust under load — one that fails CI loudly when someone passes a bad value, refuses to run a privileged container, and rolls out without taking the service down. Concretely:
- A typed
values.yamlbacked by a JSON Schema, so typos fail athelm lintrather than at 3am. - A pod template that satisfies the Restricted Pod Security Standard by default.
- An HPA whose scaling behavior is tuned so it doesn’t oscillate.
- A CI loop that lints, templates, and diffs every change before it merges.
Values design
Good values are boring values: predictable names, sane defaults, and nothing that requires reading the templates to understand. Group by concern — image, resources, autoscaling, security — and never invent a key you won’t document.
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 256Mi # no CPU limit: avoid throttling
autoscaling:
enabled: true
minReplicas: 3
maxReplicas: 12
targetCPUUtilizationPercentage: 70
Schema validation
A values.schema.json turns silent misconfiguration into a hard error. Helm validates values against it on every install, upgrade, and lint — so a stray string where a number belongs never reaches the cluster.
If a value can break production, it belongs in the schema. The schema is the contract; everything else is a suggestion.
Security context
The Restricted profile is non-negotiable for new workloads. Drop all capabilities, run as non-root, and make the root filesystem read-only. Most apps need nothing more than a writable /tmp via an emptyDir.
runAsNonRoot: trueand an explicitrunAsUser.allowPrivilegeEscalation: false,capabilities.drop: ["ALL"].readOnlyRootFilesystem: truewith mounted writable paths where genuinely needed.
HPA behavior
Default HPA behavior scales up fast and down fast — which means it flaps. Add a stabilization window on scale-down and cap how aggressively it scales up, and the autoscaler stops fighting itself during traffic spikes.
The CI loop
Every change runs helm lint, renders the chart against a set of representative value files, and diffs the rendered output against what’s live. Reviewers see exactly what Kubernetes will see — no surprises after merge.
That’s the whole point: make the safe path the default, and make the unsafe path fail loudly, early, and in front of a human.