Charts: [stable/prometheus-operator] Error: customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" already exists (with no existing CRDs)

Created on 31 Dec 2018  路  12Comments  路  Source: helm/charts

BUG REPORT

Version of Helm and Kubernetes: Kubernetes v1.11.5 | Helm v2.12.0

Which chart: stable/prometheus-operator

What happened: When installing stable/prometheus-operator fails with customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" already exists
even checked that the CRD doesn't exist previously

What you expected to happen: Install without errors

How to reproduce it (as minimally and precisely as possible):
First I ensure there is no previous version installed:

$ helm ls --all
NAME            REVISION    UPDATED                     STATUS      CHART                       APP VERSION NAMESPACE
kube-dashboard  2           Mon Dec 31 11:13:48 2018    DEPLOYED    kubernetes-dashboard-0.10.2 1.10.1      kube-system

I remove CRD as described in doc:

$ kubectl get crd --all-namespaces
NAME                                    CREATED AT
alertmanagers.monitoring.coreos.com     2018-12-31T10:42:46Z
eniconfigs.crd.k8s.amazonaws.com        2018-12-31T09:00:10Z
prometheuses.monitoring.coreos.com      2018-12-31T10:42:46Z
prometheusrules.monitoring.coreos.com   2018-12-31T10:42:46Z
servicemonitors.monitoring.coreos.com   2018-12-31T10:42:46Z
$ kubectl delete crd/alertmanagers.monitoring.coreos.com crd/prometheuses.monitoring.coreos.com crd/prometheuses.monitoring.coreos.com crd/prometheusrules.monitoring.coreos.com crd/servicemonitors.monitoring.coreos.com
customresourcedefinition.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" deleted
customresourcedefinition.apiextensions.k8s.io "prometheuses.monitoring.coreos.com" deleted
customresourcedefinition.apiextensions.k8s.io "prometheusrules.monitoring.coreos.com" deleted
customresourcedefinition.apiextensions.k8s.io "servicemonitors.monitoring.coreos.com" deleted

There is not CRD:

$ kubectl get crd --all-namespaces
NAME                               CREATED AT
eniconfigs.crd.k8s.amazonaws.com   2018-12-31T09:00:10Z

With the environment clean (no CRD or previous helm installation), the installation fails:

$ helm install stable/prometheus-operator --name "monitoring" --namespace monitoring
Error: release monitoring failed: customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" already exists

If I delete helm installation and CRD, it happens the same error

$ kubectl get crd --all-namespaces
NAME                               CREATED AT
eniconfigs.crd.k8s.amazonaws.com   2018-12-31T09:00:10Z
$ helm install stable/prometheus-operator --name "monitoring" --namespace monitoring --debug
[debug] Created tunnel using local port: '64985'

[debug] SERVER: "127.0.0.1:64985"

[debug] Original chart version: ""
[debug] Fetched stable/prometheus-operator to <local path>/.helm/cache/archive/prometheus-operator-1.1.0.tgz

[debug] CHART PATH: <local path>/.helm/cache/archive/prometheus-operator-1.1.0.tgz

Error: release monitoring failed: customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" already exists

Most helpful comment

kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd prometheuses.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd podmonitors.monitoring.coreos.com

helm install --name prometheus-operator stable/prometheus-operator\
 --set grafana.enabled=false

All 12 comments

This issue has already been reported here and identified as an issue with helm/helm.

To be more specific: This is tracked by helm/helm#5054 and upgrading to Helm 2.12.1 should rectify the problem.

I'm having that issue, what should I do to resolve it?

I'm having this issue as well after running helm delete --purge on prometheus-operator. Can't reinstall, even with --replace.

The same for
```bash
~$ helm install --name prometheus-operator stable/prometheus-operator

--namespace git2prod-system
--set grafana.enabled=false

Error: customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" already exists

~$ helm version
Client: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}```

I was able to get past the issue by deleting all of the CRDs created by prometheus-operator (list them with kubectl get crd -A). I'm not able to retrieve the snippet right now, but I'll post back later today with it.

kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd prometheuses.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd podmonitors.monitoring.coreos.com

helm install --name prometheus-operator stable/prometheus-operator\
 --set grafana.enabled=false

Yep, that's it!

Just to note I'm still seeing this with helm 2.14.3

Delete all monitoring CRDs.
workaround of @solohin works with me !!

it seems that I deployed prometheus from https://operatorhub.io and I forgot to delete it before using helm.

I am trying to deploy prometheus-operator for the first time using helm and yet i face the error "Error: customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" already exists".
I checked the crds with "kubectl get crd -A" and found "alertmanagers.monitoring.coreos.com" was one of them.
Does "alertmanagers.monitoring.coreos.com" come out of the box with Kubernetes?

kubectl delete crd thanosrulers.monitoring.coreos.com

kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd prometheuses.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd podmonitors.monitoring.coreos.com

helm install --name prometheus-operator stable/prometheus-operator\
 --set grafana.enabled=false

Great!
Just adding here another CRDs

kubectl delete crd thanosrulers.monitoring.coreos.com

Was this page helpful?
0 / 5 - 0 ratings