Bootstrap FreeKB - OpenShift - Resolve error: rolebinding found for "Role", not "ClusterRole"
OpenShift - Resolve error: rolebinding found for "Role", not "ClusterRole"

Updated:   |  OpenShift articles

Let's say you are attempting to add a User, Group or Service Account to a Role Binding and something like this is being returned. In this example, the error is returned when attempting to add Group "my-group" to Role Binding "my-role-binding".

~]$ oc adm policy add-role-to-group basic-user my-group --rolebinding-name my-role-binding
error: rolebinding my-role-binding found for "Role", not "ClusterRole"

 

Notice in this example that an attempt was made to add Group "my-group" to Role Binding "my-role-binding" with role basic-user. It is probably the case that Role basic-user does not exist in the namespace. basic-user is a Cluster Role, not a Role within the current namespace.

~]$ oc get roles
NAME             CREATED AT
my-role          2023-07-07T15:42:28Z

 

Thus the solution is to use add-cluster-role-to-group

~]$ oc adm policy add-cluster-role-to-group basic-user my-group --rolebinding-name my-role-binding
clusterrole.rbac.authorization.k8s.io/basic-user added: "my-group"

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter b59251 in the box below so that we can be sure you are a human.