Helm for deploying .NET services to Kubernetes: charts, Go templates, values per environment, releases and revision history, upgrade/rollback and hooks, OCI chart registries, and the trade-offs against Kustomize overlays.
Helm is the package manager for Kubernetes. A chart is a set of manifest templates (Go templating) plus a values.yaml of defaults. You install it as a release, overriding values per environment with files like values-prod.yaml. Helm stores each revision in the cluster, so helm upgrade --install --atomic deploys and helm rollback returns to an earlier revision. Charts are versioned and pushed to OCI registries such as Azure Container Registry.
Kustomize takes the opposite approach: plain YAML bases with environment overlays and patches, no templating, built into kubectl apply -k.
I use Helm when a chart is shared across many services or for third-party software, and Kustomize for simple in-house overlays. The trade-off: Helm's power versus template complexity.
"Without a tool, deploying one .NET API to three environments means three copies of the same deployment, service, HPA and route YAML that drift apart. Helm fixes that by templating. A chart has a
Chart.yamlwith the chart version and app version, atemplatesfolder with manifests containing Go template expressions like{{ .Values.image.tag }}, and avalues.yamlwith defaults. For production I layervalues-prod.yamlon top with more replicas, bigger resources and the prod hostname, and CI passes the image tag with--set image.tag=$SHA.When I run
helm upgrade --install orders-api ./chart -f values-prod.yaml --atomic --wait, Helm renders the templates, applies them, and records a release revision in a Secret in the namespace.--waitblocks until the pods are ready and--atomicrolls back automatically if they aren't.helm historylists revisions andhelm rollback orders-api 41re-applies an earlier one. In our setup one shared library chart in Azure Container Registry, as an OCI artefact, gives every .NET service the same probes, security context, resource defaults and a checksum annotation that restarts pods when the ConfigMap changes. A new service's chart is about 20 lines of values.Kustomize is the template-free alternative: a base folder of real YAML and overlays per environment that patch it. It's built into kubectl and very readable, but sharing logic across fifty services is harder. For example, at [company] we [moved twelve services from copied YAML to a shared Helm library chart], which cut [deployment config from about 3,000 lines to 400] and made a security-context change a one-line chart bump. The mistake I see is thinking
helm rollbackrolls back everything: it reverts manifests, not the EF Core migration that ran in a pre-upgrade hook."
| Concept | What it is |
|---|---|
| Chart | Package of templates + Chart.yaml + values.yaml |
| Values | Inputs; layered: chart defaults → -f files → --set |
| Release | A named installation of a chart in a namespace |
| Revision | Each install/upgrade/rollback; stored as a Secret |
| Hooks | Jobs at lifecycle points (pre-upgrade, post-install), e.g. migrations |
| Library chart | Shared templates other charts depend on |
| OCI registry | helm push to ACR; oci://crplatform.azurecr.io/charts |
| Helm | Kustomize | |
|---|---|---|
| Approach | Templates + values | Base + overlays + patches |
| Learning curve | Go templates, _helpers.tpl |
Plain YAML |
| Packaging and versioning | Yes (chart versions, OCI) | No (Git folders) |
| Release history and rollback | Built in | Via Git revert / GitOps |
| Third-party software | Standard (ingress controllers, cert-manager, KEDA) | Rare |
| Built into kubectl | No | Yes (kubectl apply -k) |
| Best for | Shared patterns, many services | Few services, simple env differences |
With a shared library chart, twelve .NET services used identical probes and security settings. Enabling readOnlyRootFilesystem across all of them was one chart release rolled out in a day, and --atomic caught two services that wrote to /tmp, rolling them back automatically with no downtime.
Checks that the candidate can manage Kubernetes deployments across environments and understands the limits of Helm rollbacks.
Green flags
--atomic --wait and knows rollback scopeRed flags
helm rollback undoes migrations chart + values-prod.yaml + --set image.tag=abc123
│
▼ render (Go templates + Sprig functions)
plain manifests
│
▼ compare with last release (3-way merge with live state)
apply to API server
│
▼ --wait: deployments ready? no ─▶ --atomic: rollback to previous revision
store revision N as Secret sh.helm.release.v1.orders-api.vN
The stored release contains the rendered manifests and values, which is why helm get values and helm get manifest can show exactly what was deployed.
values.yaml in the chart → parent chart values → each -f file in order → --set and --set-string. Later wins. Keep secrets out of values files; reference Kubernetes secrets created by the Key Vault CSI driver or External Secrets Operator instead.
_helpers.tpl with define / include for names and labels.toYaml .Values.resources | nindent 12 to pass blocks through.checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} as a pod annotation so a ConfigMap change rolls the pods.required "image.tag is required" .Values.image.tag to fail fast.values.schema.json to validate values with JSON Schema.A pre-upgrade hook Job can run an EF Core migration bundle before new pods start. But rollback doesn't undo it, so migrations must be backward compatible (expand and contract): the old version must still work against the new schema. Hook Jobs also block the release if they hang; set activeDeadlineSeconds and a hook-delete-policy.
Helm 3 removed Tiller (no in-cluster server component) and stores releases as Secrets. Helm 4 was released in late 2025 with server-side apply support and other modernisation; check the current release notes before relying on specific behaviour. Charts are commonly distributed through OCI registries now rather than classic chart repositories.
k8s/
base/ deployment.yaml service.yaml kustomization.yaml
overlays/
test/ kustomization.yaml (replicas: 1, image tag)
prod/ kustomization.yaml + patch-resources.yaml (replicas: 4)
kustomization.yaml lists resources, images: to set tags, patches: (strategic merge or JSON 6902), and configMapGenerator which appends a content hash to the ConfigMap name, so pods roll automatically when config changes. Argo CD and Flux render both Helm and Kustomize, and Kustomize can even inflate Helm charts.
helm create orders-api, strip it down, and helm template . -f values-prod.yaml to see the rendered YAML.--atomic --wait --timeout 2m, and watch it roll back.helm history and helm rollback to a previous revision.helm push orders-api-0.1.0.tgz oci://<acr>.azurecr.io/charts.A minimal chart for a .NET 10 API. templates/deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "orders-api.fullname" . }}
labels: {{- include "orders-api.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels: {{- include "orders-api.selectorLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "orders-api.selectorLabels" . | nindent 8 }}
annotations:
# Restart pods when config changes
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
securityContext: { runAsNonRoot: true }
containers:
- name: api
image: "{{ .Values.image.repository }}:{{ required "image.tag is required" .Values.image.tag }}"
ports: [{ containerPort: 8080 }]
envFrom: [{ configMapRef: { name: {{ include "orders-api.fullname" . }} } }]
resources: {{- toYaml .Values.resources | nindent 12 }}
readinessProbe: { httpGet: { path: /healthz/ready, port: 8080 } }
Values per environment:
# values.yaml (defaults)
replicaCount: 1
image:
repository: crordersprod.azurecr.io/orders-api
tag: ""
resources:
requests: { cpu: 250m, memory: 256Mi }
limits: { memory: 256Mi }
config:
ASPNETCORE_ENVIRONMENT: Development
---
# values-prod.yaml
replicaCount: 4
resources:
requests: { cpu: 500m, memory: 512Mi }
limits: { memory: 512Mi }
config:
ASPNETCORE_ENVIRONMENT: Production
Deploying from CI and rolling back:
helm upgrade --install orders-api ./charts/orders-api \
--namespace orders --create-namespace \
-f charts/orders-api/values-prod.yaml \
--set image.tag="$GITHUB_SHA" \
--atomic --wait --timeout 5m # auto-rollback if pods don't become ready
helm history orders-api -n orders
helm rollback orders-api 41 -n orders --wait
The Kustomize equivalent of the prod overlay:
# k8s/overlays/prod/kustomization.yaml
resources: [../../base]
images:
- name: crordersprod.azurecr.io/orders-api
newTag: "1.4.2"
replicas:
- name: orders-api
count: 4
configMapGenerator:
- name: orders-api-config
literals: [ASPNETCORE_ENVIRONMENT=Production] # name gets a hash suffix, so pods roll on change
values-prod.yaml. Why it is wrong: They end up in Git and in the release Secret in plain text. Instead: Workload Identity to Key Vault, or the Key Vault CSI driver / External Secrets Operator, referenced by name.helm upgrade without --atomic --wait. Why it is wrong: Helm reports success as soon as manifests are applied, even if pods crash. Instead: --wait with a timeout and --atomic for automatic rollback.helm rollback to undo database migrations. Why it is wrong: It only re-applies old manifests. Instead: Backward-compatible (expand/contract) migrations so the previous version still works.values.schema.json.configMapGenerator hash (Kustomize).--version and upgrade deliberately.Helm and Kustomize answer different questions. Helm answers "how do we package and version a deployable unit and reuse it"; Kustomize answers "how do we vary plain YAML per environment". For an organisation with many .NET services, a versioned library chart encoding the platform's standards (non-root, probes, resource defaults, Workload Identity labels) is one of the most effective guardrails you can build. For a team with three services, Kustomize plus GitOps is often simpler and easier to review.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| Helm charts | Many services, shared standards, third-party apps | Template complexity, Helm knowledge | A couple of services with tiny differences |
| Kustomize | Few in-house services, readable diffs | Weak reuse across repos | Distributing software to others |
| Helm + GitOps (Argo CD / Flux) | Audited, pull-based delivery | Another system to run | Very small teams |
| Azure Container Apps (no manifests) | Want to avoid Kubernetes YAML | Less flexibility | Need Kubernetes features |
I measure it by the size of per-service deployment config, failed rollouts caught by --atomic, and drift found by GitOps.
Kubernetes runs containers from declarative desired state. A pod is the smallest unit: one or more containers sharing an IP and volumes, and it is disposable. A deployment says "run 3 replicas of this image" and manages ReplicaSets to do rolling updates and rollbacks. A service gives those changing pods a stable DNS name and virtual IP and load-balances across them. Ingress (or the newer Gateway API) routes external HTTP traffic and terminates TLS.
Configuration comes from ConfigMaps and secrets, injected as environment variables or files, which ASP.NET Core reads through IConfiguration. Probes call your health endpoints.
The trade-off: huge flexibility and portability, at the cost of a lot of moving parts to run.
A secret is anything that grants access or proves identity: database passwords, API keys and tokens, client secrets, JWT signing keys, SAS tokens. The best secret is no secret at all: in Azure I use managed identity so the app authenticates to Azure SQL, Storage and Service Bus with Entra tokens, not stored credentials. What must remain a secret, typically a third-party API key that doesn't support Entra, goes in Azure Key Vault, read through the AddAzureKeyVault configuration provider using the app's managed identity, with Key Vault RBAC per app and a vault per environment. Locally, developers use dotnet user-secrets or their own Entra sign-in against a dev vault. Nothing goes in appsettings.json or the repo, and secret scanning blocks pushes. The trade-off: Entra and Key Vault become runtime dependencies with network hops and throttling limits, so you load at start-up, cache and reload on an interval, and automate rotation rather than doing it by hand.
Run an EF Core migration bundle once per release, as a Helm pre-upgrade hook Job or a pipeline step, never in every pod's startup. Use a dedicated identity with DDL rights. Make migrations backward compatible (expand then contract): add columns as nullable, deploy code that uses them, and drop old columns in a later release. Then helm rollback to the previous version still works against the new schema.
How to tell it (STAR)
**S:** We had [twelve] .NET services with copied Kubernetes YAML and an audit was coming that required non-root containers and consistent probes. **T:** I was asked to make every service compliant without a big-bang change. **A:** I wrote a shared Helm library chart with the security context, probes and resource defaults, published it to ACR, and migrated services one at a time using `--atomic --wait` so failures rolled back automatically. Two services broke on read-only file systems, so we gave them an `emptyDir` for `/tmp`. **R:** All [twelve] passed the audit, per-service deployment config dropped from about [250] lines to [30], and Azure Policy now blocks regressions.
Last updated 23 Nov 2026.