返回顶部

k8s clusterrolebinding 报错“cannot change roleRef”

k8s  clusterrolebinding 报错“cannot change roleRef”

在创建kubernetes的dashboard用户时出现报错

k8s  clusterrolebinding 报错“roleRef: Invalid value: rbac.RoleRef{APIGroup:"rbac.authorization.k8s.io", Kind:"ClusterRole", Name:"pro"}: cannot change roleRef”

 

 分析原因

根据报错信息分析得出报错为ClusterRoleBinding,检查发现是ClusterRoleBinding的用户已存在,修改掉或删掉原来的即可结局

解决

修改YANML文件解决

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: pro
  namespace: kubernetes-dashboard
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: pro
subjects:
  - kind: ServiceAccount
    name: pro
    namespace: kubernetes-dashboard

 

posted @ 2022-09-11 21:04  九尾cat  阅读(743)  评论(0编辑  收藏  举报