Flagger’s “in order of disappearance” issue

Installing Flagger via Helm should be straightforward:
https://docs.flagger.app/install/flagger-install-on-kubernetes

A problem, however, appears after installing the CRDs:

kubectl apply -f https://raw.githubusercontent.com/fluxcd/flagger/main/artifacts/flagger/crd.yaml

and then moving on to install

helm upgrade -i flagger flagger/flagger \
--namespace=istio-system \
--set crd.create=false \
--set meshProvider=istio \
--set metricsServer=http://prometheus:9090

yields a problem:

Error: failed to install CRD crds/crd.yaml: conflict occurred while applying object /canaries.flagger.app apiextensions.k8s.io/v1, Kind=CustomResourceDefinition: Apply failed with 1 conflict: conflict with "kubectl-client-side-apply" using apiextensions.k8s.io/v1: .spec.versions

If you try to deinstall the CRD’s, and install it as part of the Helm installation, as:

helm upgrade -i flagger flagger/flagger --namespace=istio-system --set crd.create=true --set meshProvider=istio --set metricsServer=http://prometheus:9090

the issue then becomes the following:

Error: unable to continue with install: CustomResourceDefinition "canaries.flagger.app" in namespace "" 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 "flagger"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "istio-system"

Also, the Helm Chart page for Flagger explains that crd.create should be set to true only for Helm v2.
The solution is to install first the Helm Chart, and then add the CRDs – swap the steps 2. and 3. and it should all work, with a few non-fatal warnings:

helm upgrade -i flagger flagger/flagger --namespace=istio-system --set crd.create=false --set meshProvider=istio --set metricsServer=http://prometheus:9090 --version 1.42.0
Release "flagger" does not exist. Installing it now.
NAME: flagger
LAST DEPLOYED: Sun Dec 28 16:43:34 2025
NAMESPACE: istio-system
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
TEST SUITE: None
NOTES:
Flagger installed
kubectl apply -f https://raw.githubusercontent.com/fluxcd/flagger/main/artifacts/flagger/crd.yaml
Warning: resource customresourcedefinitions/canaries.flagger.app is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/canaries.flagger.app configured
Warning: resource customresourcedefinitions/metrictemplates.flagger.app is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/metrictemplates.flagger.app configured
Warning: resource customresourcedefinitions/alertproviders.flagger.app is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
customresourcedefinition.apiextensions.k8s.io/alertproviders.flagger.app configured

Leave a Comment

Your email address will not be published. Required fields are marked *