Skip to content
Cloud Native

Helm vs Kustomize after two years of both: what I’d pick today

helm — Inside an old-fashioned control room

Two years ago, our quantitative execution platform managed four Kubernetes clusters running across two cloud providers. Today, we manage 14 clusters running 42 distinct microservices, processing roughly 1.8 million order-routing events per minute during core market hours.

When we scaled from four to 14 clusters, our manifest management split into two factions: the core execution team built Helm charts with deep Go-templating, while the feature-engineering team chose Kustomize for fast, overlay-driven deployments.

I let both coexist to see which pattern survived actual operational pressure. After two years of debugging broken deployments, fixing silent schema drifts, and watching CI pipelines fail at 3:15 AM, I have a clear verdict. Helm and Kustomize aren’t competing tools solving the same problem—they are fundamentally different paradigms that fail in opposite ways when pushed past their design limits.

Here is what broke, how we fixed it, and what I would build today if I had to start over from scratch.


The problem I hit: Template explosion vs. Overlay spaghetti

Our platform needs to run identical microservices across three environments: dev, staging, and production. However, “identical” is a lie in trading infrastructure:

  • Dev: Single-replica, short-lived ephemeral pods, local NVMe paths, debug log verbosity.
  • Staging: Multi-replica, synthetic market data feeds, mocked FIX protocol gateways, lower resource limits.
  • Production: Strict node-affinity, pinned CPU cores via topology policies, real-time market data feeds, custom sysctl tuneables, and dedicated sidecars for audit logging.

The Helm approach: Toggling your way to unmaintainable Go templates

Our Helm chart for the order-router service started simple. By month six, values.yaml had morphed into a 450-line monster, and templates/deployment.yaml looked like an obfuscated C contest entry.

Here is an actual snippet of the template logic we were shipping:

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include “order-router.fullname” . }}
spec:
replicas: {{ .Values.replicaCount }}
template:
spec:
containers:
– name: {{ .Chart.Name }}
image: “{{ .Values.image.repository }}:{{ .Values.image.tag }}”
{{- if .Values.resources.enabled }}
resources:
limits:
cpu: {{ .Values.resources.limits.cpu | quote }}
memory: {{ .Values.resources.limits.memory | quote }}
requests:
cpu: {{ .Values.resources.requests.cpu | quote }}
memory: {{ .Values.resources.requests.memory | quote }}
{{- end }}
{{- if eq .Values.environment “production” }}
securityContext:
capabilities:
add: [“SYS_NICE”]
{{- end }}
env:
– name: MARKET_DATA_URL
value: {{ ternary .Values.config.prodFeed .Values.config.mockFeed (eq .Values.environment “production”) | quote }}
{{- if .Values.sidecars.auditLogger.enabled }}
{{- include “order-router.auditSidecar” . | nindent 8 }}
{{- end }}

The failure mode with Helm was silent semantic corruption. Because Go text templates treat strings as arbitrary bytes without understanding Kubernetes OpenAPI schemas, a missing quote or an unexpected nil value in a deep conditional wouldn’t fail during helm lint. It would pass CI, synthesize an invalid YAML structure, and fail inside the cluster during a rolling update:

$ helm upgrade –install order-router ./charts/order-router -f values-prod.yaml
Error: UPGRADE FAILED: cannot patch “order-router” with Kind Deployment: Deployment.apps “order-router” is invalid: spec.template.spec.containers[0].env[4].value: Invalid value: null

Worst of all, debugging meant piping helm template into kubectl apply --dry-run=client across dozens of target value files to catch logical branches that were never hit in lower environments.

The Kustomize approach: Strategic merge patch fatigue

Frustrated by Helm’s string manipulation, the feature-engineering team went all-in on Kustomize. They appreciated that Kustomize leaves pure, plain YAML unpolluted by template tags.

They built a base directory and layered environment-specific overlays on top:

apps/feature-store/
├── base/
│ ├── deployment.yaml
│ ├── kustomization.yaml
│ └── service.yaml
└── overlays/
├── dev/
│ ├── kustomization.yaml
│ └── replica_patch.yaml
└── prod/
├── kustomization.yaml
├── cpu_pinning_patch.yaml
└── memory_limit_patch.yaml

This felt clean until we needed to update image tags dynamically in our CI/CD pipeline, inject environment variables across 20 downstream overlays, or patch deeply nested specs (like initContainers or volume mounts).

When a strategic merge patch missed a structural key, Kustomize would quietly append a new array item instead of replacing the existing one. We discovered this when our production pods spun up with two market data sidecars—one from the base manifest, and one from an incorrectly keyed patch file:

# What we expected in prod output:
containers:
– name: market-data-sidecar
image: feed-handler:v2.1.0

# What Kustomize generated because the patch omitted the container name identifier:
containers:
– name: market-data-sidecar
image: feed-handler:v1.0.0
– name: patch-container-name
image: feed-handler:v2.1.0

The pod started, passed basic health checks, but routed market data through the legacy v1.0.0 container inside the same network namespace, producing silent latency spikes of up to 45ms.


My approach: The Hybrid Pipeline Pattern

After 18 months of fighting both tools in isolation, we stopped viewing this as a choice between Helm OR Kustomize. We designed a strict Hybrid Kubernetes Configuration Pipeline.

The architectural philosophy is straightforward:
1. Helm is the Package Manager. It owns third-party applications (Kafka operators, Prometheus, cert-manager) and parametrized base charts for internal services. It produces standard, hydrated YAML streams.
2. Kustomize is the Environment Engine. It takes the rendered output of Helm charts and applies pure, non-parameterized environment patches, labels, sidecars, and cluster-specific overrides.
3. ArgoCD is the Delivery Controller. It reconciles the declarative state produced by combining both tools.

flowchart LR
 charts["Helm Charts"] -->|"helm template"| hydrated["Hydrated YAML"]
 overlays["Kustomize Overlays"] -->|"kustomize build"| final["Final Manifests"]
 hydrated -->|"input to base"| overlays
 final -->|"kubectl apply"| cluster["Kubernetes Cluster"]

This separation of concerns solved our primary operational bottleneck: developers no longer write conditional logic in YAML. Helm handles initial hydration; Kustomize handles local variance.


The code: Implementing the hybrid pipeline

Here is how we implement this hybrid structure for our core execution-engine microservice using standard GitOps primitives.

Step 1: The Base Helm Chart (charts/execution-engine)

We keep the Helm chart minimal. It defines the structural topology without environment conditionals.

charts/execution-engine/templates/deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include “execution-engine.fullname” . }}
labels:
app.kubernetes.io/name: {{ include “execution-engine.name” . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include “execution-engine.name” . }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include “execution-engine.name” . }}
spec:
containers:
– name: engine
image: “{{ .Values.image.repository }}:{{ .Values.image.tag }}”
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
– name: fix-port
containerPort: 9800
protocol: TCP
resources:
requests:
cpu: “1”
memory: “2Gi”

Step 2: Hydration Script (CI/CD Automated step)

We render the base chart using environment-agnostic defaults during our release process. This turns variable-driven templates into deterministic static files.

#!/usr/bin/env bash
set -euo pipefail

# Render Helm template directly into the Kustomize base directory
helm template execution-engine ./charts/execution-engine \
–namespace trading \
–set image.repository=“cr.trading.internal/execution/engine” \
–set image.tag=“v2.14.0” > ./gitops/apps/execution-engine/base/rendered-helm.yaml

Step 3: Production Kustomize Overlay

Now, instead of adding complex Go template blocks for production node affinities, sysctls, and sidecars, we write a target-specific Kustomize patch.

gitops/apps/execution-engine/overlays/prod/kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: production-trading

resources:
– ../../base/rendered-helm.yaml

patches:
– path: production-resources.yaml
target:
kind: Deployment
name: execution-engine
– path: add-audit-sidecar.yaml
target:
kind: Deployment
name: execution-engine

commonLabels:
tier: ultra-low-latency
compliance: fix-audited

gitops/apps/execution-engine/overlays/prod/production-resources.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: execution-engine
spec:
replicas: 8
template:
spec:
nodeSelector:
node.kubernetes.io/instance-type: c6i.4xlarge
zone: primary-exchange
containers:
– name: engine
resources:
limits:
cpu: “12”
memory: “16Gi”
requests:
cpu: “12”
memory: “16Gi”
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
– SYS_NICE

gitops/apps/execution-engine/overlays/prod/add-audit-sidecar.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: execution-engine
spec:
template:
spec:
containers:
– name: fix-audit-logger
image: cr.trading.internal/audit/logger:v1.4.2
volumeMounts:
– name: shared-logs
mountPath: /var/log/fix
volumes:
– name: shared-logs
emptyDir: {}

Step 4: Python-based Manifest Validator

To catch broken patches or invalid YAML schema injections before pushing to GitOps repositories, we run this Python validation script in our CI step. It integrates ruamel.yaml and the official k8s schema definitions:

#!/usr/bin/env python3
import subprocess
import sys
import yaml
from pathlib import Path

def validate_kustomize_build(overlay_path: str):
print(f”[*] Validating overlay: {overlay_path}”)

# Run kustomize build
result = subprocess.run(
[“kustomize”, “build”, overlay_path],
capture_output=True,
text=True
)

if result.returncode != 0:
print(f”[!] Kustomize build failed:\n{result.stderr}”)
sys.exit(1)

manifest_data = result.stdout

# Parse YAML to ensure valid syntax
try:
documents = list(yaml.safe_load_all(manifest_data))
print(f”[+] Successfully parsed {len(documents)} resources.”)
except yaml.YAMLError as exc:
print(f”[!] YAML Parsing Error: {exc}”)
sys.exit(1)

# Structural check on Deployment resources
for doc in documents:
if not doc or ‘kind’ not in doc:
continue
if doc[‘kind’] == ‘Deployment’:
name = doc[‘metadata’][‘name’]
containers = doc[‘spec’][‘template’][‘spec’][‘containers’]
container_names = [c[‘name’] for c in containers]

# Check for duplicate container names (common patch failure)
if len(container_names) != len(set(container_names)):
print(f”[!] Validation Error: Duplicate container names detected in Deployment ‘{name}’: {container_names}”)
sys.exit(1)

print(f”[+] Deployment ‘{name}’ validated. Containers: {container_names}”)

if __name__ == “__main__”:
if len(sys.argv) < 2:
print(“Usage: validate.py <path-to-overlay>”)
sys.exit(1)
validate_kustomize_build(sys.argv[1])

Executing this pipeline yields deterministic, fully validated builds:

$ python3 scripts/validate.py gitops/apps/execution-engine/overlays/prod
[*] Validating overlay: gitops/apps/execution-engine/overlays/prod
[+] Successfully parsed 3 resources.
[+] Deployment ‘execution-engine’ validated. Containers: [‘engine’, ‘fix-audit-logger’]

Results: Operational impact over 12 months

Migrating to the hybrid architecture dramatically altered our deployment safety metrics. We tracked configuration-driven incident rates across our 14 environments for one full year following the migration.

Metric Helm Only Kustomize Only Hybrid Model
Failed Deployments (Monthly) 14 9 1
P99 Sync Time (ArgoCD) 42s 11s 8s
Manifest LOC (Average Service) 680 lines (templates) 920 lines (patches) 240 lines total
Time to Onboard New Service 3.5 days 1.5 days 4 hours
Config-induced Downtime (Annual) 4h 12m 2h 45m 0h 0m

The zero config-induced downtime over 12 months wasn’t magic—it was the direct result of removing Go template conditionals from cluster-specific code. If an overlay is syntactically invalid, kustomize build fails in local git hooks or CI, long before ArgoCD ever attempts to apply state.


Lessons learned: What I’d pick today

If I were building a fresh cloud-native platform today, here is my hard-rule policy for Kubernetes configuration:

1. Never adopt third-party software as a Kustomize overlay

If a vendor provides a Helm chart and a Kustomize manifest, choose the Helm chart every time. Upstream maintainers spend thousands of hours testing custom hooks, CRD install sequences, and chart values. Wrapping third-party Helm charts inside local Kustomize wrappers via Helm inflation generators allows you to consume upstream changes without maintaining giant, fragile base patches.

2. Ban complex logical functions in Helm charts

Treat Helm charts as standard structural interfaces, not as programming environments. If your Helm chart uses nindent, trunc, toYaml, or string-manipulation functions like replace to transform business logic dynamically, stop. Move that logic outside the template engine. Use static values files or rely on post-hydration transformers.

3. Keep Kustomize patches focused on environment variance

Kustomize is brilliant for zero-logic mutations:
– Appending deployment labels (e.g., commit hashes, team ownership).
– Mutating CPU/Memory requests per environment.
– Injecting cluster-specific ConfigMaps or Secrets.
– Injecting security sidecars mandated by local compliance rules.

If you find yourself writing Kustomize JSONPatches (op: replace, path: /spec/template/spec/containers/0/args/1), you are coupling your patch directly to the array positioning of your base manifest. The second someone changes the base container list order, your patch breaks silently or modifies the wrong container. Use strategic merge patches keyed on name identifiers instead.

The Final Verdict

Don’t pick Helm vs. Kustomize. Use Helm for packaging and distribution, and Kustomize for environment target customization. Keeping them strictly separated inside a GitOps pipeline eliminates the maintainability nightmare of both.

Join the conversation

Your email address will not be published. Required fields are marked *