Cloud / HELM Interview Questions
What is the three-way strategic merge patch and why is it important for Helm upgrades?
The three-way strategic merge patch is Helm v3's intelligent algorithm for determining exactly what changed during an upgrade, minimizing unnecessary pod restarts and resource updates.
How it works: Helm compares three versions of each resource:
- Current state - What's actually running in the cluster (live manifests)
- Previous release state - What was last deployed (saved in release secret)
- New state - What the current chart + values renders to
Why three-way matters: Two-way merge (Helm v2) only compared previous state vs new state, missing manual changes made to live resources. With three-way merge, Helm can detect:
- Changes made manually in the cluster (external modifications)
- Values that were removed from values.yaml (should be reverted)
- Fields that should not be touched (preserve cluster-specific settings)
Strategic merge patch fields: $patch: delete removes fields that would otherwise be retained. $retainKeys: [...] specifies which fields should be kept when merging.
Use with annotations: helm.sh/resource-policy: keep prevents Helm from deleting a resource during upgrade/uninstall (useful for PVCs, namespaces, CRDs).
Performance impact: Three-way merge reduces unnecessary churn - only fields that truly differ trigger updates. For deployments, this prevents rolling restarts when only labels or annotations change on non-pod template fields.
More Related questions...