<p>I want to make a role that allows to do any operation on "Roles" and "RoleBindings" (but not ClusterRoles or ClusterRoleBindings) on a namespace level.</p>

<p>This is the roles YAML I put together but when binding it to a service account it is now applied. What did I do wrong?</p>

<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: role-binder
  namespace: foo-namespace
rules:
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - Role
  - RoleBinding
  verbs:
  - '*'
</code></pre>

Hedge
<p>You can achieve that with the following rules: </p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: role-grantor
rules:
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["rolebindings"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["roles"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: role-grantor-binding
  namespace: office
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: role-grantor
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: employee
</code></pre>

<p>I tested it on my lab and it works as you desire: </p>

<pre><code>$ kubectl --context=employee-context get role 
NAME                 AGE
deployment-manager   15m
role-binder          12m

$ kubectl --context=employee-context get rolebindings
NAME                         AGE
deployment-manager-binding   15m
role-grantor-binding         3m37s

$ kubectl --context=employee-context get clusterrolebindings
Error from server (Forbidden): clusterrolebindings.rbac.authorization.k8s.io is forbidden: User "employee" cannot list resource "clusterrolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope
</code></pre>

<p>You can read more about this specifically in the <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#restrictions-on-role-binding-creation-or-update" rel="nofollow noreferrer">documentation</a>.</p>
