Interview Prep/Helm/Install & Upgrade Failures

`Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: Service "shop-api" in namespace "shop" exists and cannot be imported into the current release: invalid ownership 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": must be set to "shop"`

AdvancedTroubleshootingInstall & Upgrade Failures
Answer

Likely causes → The object was created outside Helm (kubectl apply, another tool), by another release, or survived a previous uninstall (resource-policy: keep, a failed uninstall).

Diagnose →

kubectl get svc shop-api -n shop -o yaml | yq '.metadata.labels, .metadata.annotations'
helm list -A | grep -i shop

Fix → If it is safe for this release to own it, adopt it:

kubectl label svc shop-api -n shop app.kubernetes.io/managed-by=Helm --overwrite
kubectl annotate svc shop-api -n shop meta.helm.sh/release-name=shop meta.helm.sh/release-namespace=shop --overwrite

On Helm 3.17+ you can use --take-ownership instead. If it belongs to another release, rename the resource in your chart (fullnameOverride) or delete the stale object.

Prevent → One tool owns each object; migrate kubectl-managed resources deliberately.

All Helm questions Roadmap: Helm

More on Install & Upgrade Failures