Skip to content

Helm 4: "UPGRADE FAILED: conflict with kubectl-set" after kubectl set env

Kubernetestested on Ubuntu 24.04, k3s v1.37.2+k3s1, Helm v4.3.2 (Server-Side Apply)

An environment variable was set on the deployment by hand. The next helm upgrade fails instead of restoring the chart's state. That is not a bug: Helm 4 shows you the drift.

Symptom

helm upgrade lotse ~/lotse/chart -n lotse
Error: UPGRADE FAILED: conflict occurred while applying object lotse/lotse apps/v1, Kind=Deployment: Apply failed with 1 conflict: conflict with "kubectl-set" using apps/v1: .spec.template.spec.containers[name="lotse"].env[name="ADMIN_PASSWORT"].value

Before that, someone had run kubectl -n lotse set env deploy/lotse ADMIN_PASSWORT=….

Diagnosis

Show what is really running and who owns which field.

kubectl -n lotse set env deploy/lotse --list
# Deployment lotse, container lotse
OLLAMA_URL=http://ollama:11434
MODELL=qwen3:4b-instruct
ADMIN_PASSWORT=Herbst2026

kubectl -n lotse get deploy lotse --show-managed-fields -o yaml | grep -n 'manager:'
61:    manager: helm
73:    manager: kubectl-rollout
87:    manager: kubectl-set
121:    manager: k3s

Causes

driftThe cluster has drifted from the chart

kubectl set env changes the deployment without Helm knowing. helm get values still shows the value from the chart.

server-side applyHelm 4 respects other field managers

The API server remembers who last set each field. If a field belongs to kubectl-set, Helm reports a conflict instead of overwriting it.

Fix

Decide that the chart wins and enforce it deliberately. Afterwards the chart's value applies again.
helm upgrade lotse ~/lotse/chart -n lotse --force-conflicts
Release "lotse" has been upgraded. Happy Helming!
STATUS: deployed
REVISION: 3

Don't: Put --force-conflicts into every script by reflex. Then every drift disappears unnoticed.

▶
Break it yourself and find it – free
Compliance engineering: CRA and AI Act on Kubernetes, day 1: what the CRA wants from the product – classification, support period, attack surface.
Go to day 1 →

FAQ

Why does the failed attempt count as a revision?

Helm records a revision for every attempt. Revision 2 is the failed attempt, revision 3 the forced one.

How do I avoid this?

Change things only through the chart and check the cluster against the chart regularly. Passwords do not belong in the values as plain text.

Related error patterns

More