Helm "rendered manifests contain a resource that already exists" in CI
Helm refuses to overwrite resources it does not own. This error means a manifest in the chart matches an existing object that was created outside this release (manually, by another release, or by a prior failed install) and lacks the ownership metadata Helm expects.
What this error means
helm install/upgrade fails with Error: rendered manifests contain a resource that already exists. Unable to continue with install: <Kind> "<name>" in namespace "<ns>" exists and cannot be imported into the current release: invalid ownership metadata.
Error: rendered manifests contain a resource that already exists. Unable to
continue with install: ConfigMap "api-config" in namespace "prod" exists and
cannot be imported into the current release: invalid ownership metadataCommon causes
Object created outside the release
The resource was applied manually or by a different release/tool, so Helm sees a conflicting unowned object.
Leftover from a failed install
A prior failed install created the object without completing release ownership.
How to fix it
Adopt the resource into the release
Label/annotate the existing object with Helm ownership metadata so it can be imported.
kubectl annotate configmap api-config -n prod \
meta.helm.sh/release-name=api meta.helm.sh/release-namespace=prod --overwrite
kubectl label configmap api-config -n prod \
app.kubernetes.io/managed-by=Helm --overwriteOr remove/realign the conflict
- If the object is stale, delete it and let Helm create it.
- Ensure only one release/tool manages the object going forward.
- Re-run the install/upgrade.
How to prevent it
- Manage each object with exactly one release/tool.
- Do not pre-create chart-managed resources manually.
- Clean up failed installs before retrying.