jenkins 在版本“www.example.com”中没有与类型“RoleBinding”匹配的项rbac.authorization.k8s.io/v1beta1

mdfafbf1  于 2023-05-16  发布在  Jenkins
关注(0)|答案(1)|浏览(148)

我尝试使用jenkins和helm chart将一个spring api-gateway应用部署到GKE
对于RoleBinding我有此清单

apiVersion: v1
kind: ServiceAccount
metadata:
  name: api-gateway-sa
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: api-gateway-cr
rules:
  - apiGroups: [""]
    resources: [ "services", "pods", "configmaps", "endpoints" ]
    verbs: [ "get", "watch", "list" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: api-gateway-rb
  namespace: default
roleRef:
  kind: ClusterRole
  name: api-gateway-cr
  apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
  name: api-gateway-sa

并拥有这个命令
helm upgrade --install -f helm-values/values.stag.common.yaml -f helm-values/values.stag.secret.yaml -f helm-values/values.stag.yaml stag-api-gateway helm-api-gateway || build_error=true
但我一直得到错误这个
Error: UPGRADE FAILED: current release manifest contains removed kubernetes api(s) for this kubernetes version and it is therefore unable to build the kubernetes objects for performing the diff. error from kubernetes: unable to recognize "": no matches for kind "RoleBinding" in version "rbac.authorization.k8s.io/v1beta1"
我做了什么:

  • 将jenkins-slave节点中的kubernetes版本更新为1.20
  • 确保所有清单使用rbac.authorization.k8s.io/v1

接下来我能做什么?

yxyvkwin

yxyvkwin1#

1.运行命令kubectl version检查您正在使用的Kubernetes版本。确保您使用的是最新的kubernetes和Helm版本来支持rbac.authorization.k8s.io/v1
1.检查清单中的apiVersion字段,以确认它支持RoleBinding,并且它对应于Kubernetes集群支持的版本。
1.错误和manifest文件中的API版本不同,请检查在manifest文件中更新版本后是否使用了以下命令。
Kubectl apply -f <file name>
有关详细信息,请参阅以下官方文档RBAC Authorization,Deprecated API Migration Guide

相关问题