📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

What is Helm and why would a .NET team use it? Explain charts, templates, values files per environment, releases, upgrades and rollback, and compare Helm with Kustomize. When would you choose each?

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.

Mid-Level Theory Intermediate containers deployment devops helm kubernetes kustomize

🎯 Key points

  • Chart = templated Kubernetes manifests + Chart.yaml + values.yaml; validate inputs with values.schema.json
  • Values per environment (values-prod.yaml) override defaults; --set for one-offs (image tag from CI)
  • Release = installed chart instance with revision history stored in the cluster (Secrets)
  • helm upgrade --install --atomic --wait; helm rollback to a revision
  • Hooks (pre-upgrade/post-install Jobs) for one-off tasks such as EF Core migration bundles, with deadlines and delete policies
  • Shared library charts in an OCI registry (ACR) encode platform standards across many services and teams
  • Kustomize = template-free base + overlays with patches, built into kubectl -k; good for simple in-house overlays
  • Rollback reverts manifests, not database migrations or external state

⏱ 30-second answer

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.

🗣 Full answer (senior)

How I would answer this in an interview

"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.yaml with the chart version and app version, a templates folder with manifests containing Go template expressions like {{ .Values.image.tag }}, and a values.yaml with defaults. For production I layer values-prod.yaml on 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. --wait blocks until the pods are ready and --atomic rolls back automatically if they aren't. helm history lists revisions and helm rollback orders-api 41 re-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 rollback rolls back everything: it reverts manifests, not the EF Core migration that ran in a pre-upgrade hook."


Helm concepts

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 versus Kustomize

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

Production example

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.

🔍 What the interviewer is checking

Checks that the candidate can manage Kubernetes deployments across environments and understands the limits of Helm rollbacks.

Green flags

  • Explains charts, values layering and releases with history
  • Uses --atomic --wait and knows rollback scope
  • Keeps secrets out of values; mentions Key Vault integration
  • Compares Kustomize fairly and mentions GitOps

Red flags

  • Copies YAML per environment
  • Thinks helm rollback undoes migrations
  • Secrets in values files

📚 Learn in depth

1. What Helm does on upgrade

 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.

2. Values precedence

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.

3. Templates worth knowing

  • _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.

4. Hooks and migrations

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.

5. Helm versions

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.

6. Kustomize mechanics

 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.

Try it yourself

  1. helm create orders-api, strip it down, and helm template . -f values-prod.yaml to see the rendered YAML.
  2. Install to a kind cluster, upgrade with a broken image tag using --atomic --wait --timeout 2m, and watch it roll back.
  3. Run helm history and helm rollback to a previous revision.
  4. Push the chart to ACR with helm push orders-api-0.1.0.tgz oci://<acr>.azurecr.io/charts.
  5. Rebuild the same deployment as a Kustomize base and two overlays; compare readability.

💻 Code

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

⚠ Common mistakes

  • Mistake: Putting secrets in 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.
  • Mistake: 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.
  • Mistake: Expecting 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.
  • Mistake: Over-templating everything with deep conditionals. Why it is wrong: Charts become unreadable and every change risks breaking a combination. Instead: Keep charts simple, use a library chart for shared parts, validate with values.schema.json.
  • Mistake: ConfigMap changes not restarting pods. Why it is wrong: Env vars only load at start, so pods keep old config. Instead: A checksum annotation (Helm) or configMapGenerator hash (Kustomize).
  • Mistake: Editing resources by hand after a Helm deploy. Why it is wrong: The next upgrade overwrites or conflicts with the change, and history lies. Instead: Change values and redeploy, ideally through GitOps.
  • Mistake: Not pinning chart versions for third-party charts. Why it is wrong: A new chart version can change defaults under you. Instead: Pin --version and upgrade deliberately.

🏛 Senior insight: trade-offs

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.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate refers to deployments, ConfigMaps or probes in the chart Why: Checks the underlying Kubernetes objects the chart produces
    How to answer

    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.

  2. When: Candidate mentions secrets in the chart Why: Checks how they keep secrets out of Git and manifests
    How to answer

    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.

  3. When: Candidate mentions Helm hooks or rollback Why: Checks they understand schema changes are not rolled back with manifests
    How to answer

    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.

🛠 Real-world problems: how you handle them

Copied YAML drift replaced by a shared Helm library chart
Situation
[Twelve] .NET services on AKS, each with its own copied deployment YAML for [three] environments. A security review required non-root containers, read-only root file systems and consistent probes across all services before [an ISO 27001 audit].
Signals
Audit findings: [five] services running as root, [three] with no readiness probe, inconsistent resource limits. Prod-only config bugs in [two] recent releases because a value was changed in test YAML but not prod.
Investigation
Diffed manifests across services and environments with `kubectl get deploy -o yaml` and a script; found [40+] differences. Reviewed Azure Policy for AKS compliance reports, which flagged the root containers. Checked which differences were intentional (replicas, resources) and which were drift.
Resolution
Built a versioned Helm library chart in ACR with the security context, probes, resource defaults and checksum annotation; migrated services one by one with `--atomic --wait`. Two services failed on `readOnlyRootFilesystem` because they wrote to `/tmp`; `--atomic` rolled them back, and we added an `emptyDir` volume for `/tmp`.
Prevention
Azure Policy (Gatekeeper) denying root containers and pods without probes. Chart version bumps through Renovate. `helm lint` and `helm template | kubeconform` in CI. A values schema that requires image tag and resources.

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.

↩ Usually asked after

More in Containers

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me