`Error: INSTALLATION FAILED: admission webhook "validate.kyverno.svc-fail" denied the request: resource Deployment/shop/shop-api was blocked due to the following policies require-run-as-nonroot: ...`
IntermediateTroubleshootingInstall & Upgrade Failures
Answer
Likely causes → The rendered manifest violates a cluster policy (Kyverno, Gatekeeper, Pod Security Admission).
Diagnose →
helm template shop ./shop -f values-prod.yaml -s templates/api-deployment.yaml | yq '.spec.template.spec.securityContext, .spec.template.spec.containers[].securityContext'
kubectl get clusterpolicy require-run-as-nonroot -o yaml
Fix → Set the required security context in values or chart defaults. Request a documented policy exception only when justified.
Prevent → Run the same policies in CI against rendered output (Kyverno CLI, Conftest) and use --dry-run=server before deploying.
More on Install & Upgrade Failures
`Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress`Beginner`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"`Advanced`Error: INSTALLATION FAILED: cannot re-use a name that is still in use`Beginner`Error: UPGRADE FAILED: context deadline exceeded`Beginner`Error: UPGRADE FAILED: release shop failed, and has been rolled back due to atomic being set: context deadline exceeded`Intermediate`Error: UPGRADE FAILED: cannot patch "shop-api" with kind Deployment: Deployment.apps "shop-api" is invalid: spec.selector: Invalid value: v1.LabelSelector{...}: field is immutable`Advanced