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