Error: failed to install CRD crds/crd-alertmanager.yaml: unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"问题解决
我的问题是在K8s集群安装 prometheus-operator 报这个错
问题的原因
我的集群版本太高了,1.22的版本,而且 prometheus-operator 之后的版本改变了名字,旧的版本不兼容,
┌──[root@vms81.liruilongs.github.io]-[~/ansible/k8s-helm-create] └─$helm search repo prometheus-operator NAME CHART VERSION APP VERSION DESCRIPTION ali/prometheus-operator 8.7.0 0.35.0 Provides easy monitoring definitions for Kubern... azure/prometheus-operator 9.3.2 0.38.1 DEPRECATED Provides easy monitoring definitions... ┌──[root@vms81.liruilongs.github.io]-[~/ansible/k8s-helm-create] └─$helm install liruilong ali/prometheus-operator Error: failed to install CRD crds/crd-alertmanager.yaml: unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1" ┌──[root@vms81.liruilongs.github.io]-[~/ansible/k8s-helm-create]
解决办法
用新版的chart ,Github地址为:
https://github.com/prometheus-community/helm-charts/releases/download/kube-prometheus-stack-30.0.1/kube-prometheus-stack-30.0.1.tgz
这里如果小伙伴有爬墙的话,没啥问题,下载好直接安装就可以了。
没有的话,就有些麻烦,安装过程拉取不下来的镜像需要到docker仓库上找相关的镜像替换一下。
直接修改资源文件就可以了,下面是我的替换
image: k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 替换为 : docker.io/liangjw/kube-webhook-certgen:v1.1.1
k8s.gcr.io/kube-state-metrics/kube-state-metrics 替换为: docker.io/dyrnq/kube-state-metrics:v2.3.0
然后所有节点没问题之后,改一下SVC类型就可以在宿主机访问了
加油,愿被这世界温柔以待 ^_^