Bird
0
0

Why will this RoleBinding fail to grant permissions?

medium📝 Troubleshoot Q7 of 15
Kubernetes - RBAC and Security
Why will this RoleBinding fail to grant permissions?
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: bind-role
  namespace: default
subjects:
- kind: User
  name: bob
roleRef:
  kind: ClusterRole
  name: admin
  apiGroup: rbac.authorization.k8s.io
ARoleBinding cannot bind ClusterRole without ClusterRoleBinding
BRoleBinding cannot reference a ClusterRole
CNamespace field is missing
DUser 'bob' does not exist
Step-by-Step Solution
Solution:
  1. Step 1: Understand RoleBinding and ClusterRole relationship

    RoleBinding can reference ClusterRole but only within the namespace.
  2. Step 2: Check if ClusterRoleBinding is required

    To grant cluster-wide permissions, ClusterRoleBinding is needed; RoleBinding limits scope to namespace.
  3. Final Answer:

    RoleBinding cannot bind ClusterRole without ClusterRoleBinding -> Option A
  4. Quick Check:

    ClusterRoleBinding needed for cluster-wide permissions [OK]
Quick Trick: Use ClusterRoleBinding to bind ClusterRole cluster-wide [OK]
Common Mistakes:
  • Assuming RoleBinding grants cluster-wide permissions
  • Ignoring need for ClusterRoleBinding
  • Confusing RoleBinding and ClusterRoleBinding

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes