1
votes

I am installing prometheus to monitor K8S but I met this error. Can you help me? Thank you so much!!

helm version
Client: &version.Version{SemVer:"v2.13.0", 
GitCommit:"79d07943b03aea2b76c12644b4b54733bc5958d6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.0", 
GitCommit:"79d07943b03aea2b76c12644b4b54733bc5958d6", GitTreeState:"clean"}

helm install stable/prometheus-operator --name prometheus-operator --namespace monitoring

Error: customresourcedefinitions.apiextensions.k8s.io "alertmanagers.monitoring.coreos.com" is forbidden: User "system:serviceaccount:kube-system:default" cannot delete resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
1
it looks like the resource customresourcedefinitions already exists and can't be delted by the user specified in the error. can you try to delete it manually and try to install again?Amityo
sorry, but do you know how to delete it manually? sorry, I am just a beginnernguyennd
try - kubectl get customresourcedefinitions and then -kubectl delete customresourcedefinitions <name>Amityo
I tried to delete customresourcedefinitions but It still doesn't work with the same notification kubectl get customresourcedefinitions No resources found.nguyennd

1 Answers

6
votes

This is a typical situation when Tiller (server side of Helm setup) is deployed without a service account having appropriate cluster role (cluster-admin).

You need to fix your Helm setup first, to be able to proceed with prometheus-operator installation, as described here, or by running the below commands directly one by one:

  1. kubectl create serviceaccount --namespace kube-system tiller
  2. kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
  3. kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'