Skip to content

Helm: exists and cannot be imported – invalid ownership metadata

Helmtested on Helm v4.3.2

Helm only takes over an existing object if it carries the label app.kubernetes.io/managed-by: Helm and the annotations meta.helm.sh/release-name and meta.helm.sh/release-namespace of its own release. The check runs before the install – not even a release is created.

Symptom

kubectl -n tag19 create configmap gemeinsam --from-literal=von=hand
helm install b1 ./besitz -n tag19 2>&1 | fold -w 88
helm list -n tag19 -q | grep -c b1
configmap/gemeinsam created
Error: INSTALLATION FAILED: unable to continue with install: ConfigMap "gemeinsam" in na
mespace "tag19" exists and cannot be imported into the current release: invalid ownershi
p metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be
set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": mus
t be set to "b1"; annotation validation error: missing key "meta.helm.sh/release-namespa
ce": must be set to "tag19"
0

The message lists what is missing or doesn't match: label, release name, release namespace. Afterwards the release b1 doesn't exist.

Diagnosis

The object's annotations show which release it belongs to – or that it belongs to none.

kubectl -n tag19 get cm gemeinsam -o jsonpath='{.metadata.annotations}{"\n"}'
{"meta.helm.sh/release-name":"b1","meta.helm.sh/release-namespace":"tag19"}

Causes

missing keyCreated by hand

The object was created with kubectl and carries neither the label nor the annotations. Helm refuses to overwrite it.

must equalBelongs to another release

Cluster-wide objects like a ClusterRole with a fixed name hit two releases in different namespaces. The second release fails on the first.

ClusterRole "notes-leser" in namespace "" exists and cannot be imported into the current
 release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/rel
ease-name" must equal "b2": current value is "b1"

Fix

If Helm should take over the object, set the label and annotations – or install with --take-ownership. For cluster-wide objects the right fix is in the chart: they get the release name.
kubectl -n tag19b label configmap gemeinsam app.kubernetes.io/managed-by=Helm
kubectl -n tag19b annotate configmap gemeinsam meta.helm.sh/release-name=b2 \
  meta.helm.sh/release-namespace=tag19b
helm install b2 ./besitz -n tag19b | grep STATUS
configmap/gemeinsam labeled
configmap/gemeinsam annotated
STATUS: deployed
▶
Break it yourself and find it – free
Helm Charts hands-on, day 19: troubleshooting – resolving stuck and failed releases, taking over foreign objects, fixing API errors.
Go to day 19 →

FAQ

After --take-ownership I get "conflict occurred while applying"?

Now server-side apply speaks up. The field belongs to another field manager (here kubectl-create), and Helm wants a different value. --force-conflicts gives the field to Helm.

Is a failed release left behind?

No. The ownership check runs first, no release is created.

Related error patterns

More