Hint: ClusterRoleBinding with cluster-admin role = full cluster access [OK]
Common Mistakes:
Assuming permissions are limited to one namespace
Thinking only ServiceAccounts can be subjects
Confusing ClusterRoleBinding with RoleBinding scope
4. You applied this YAML to create a RoleBinding:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-pods
subjects:
- kind: User
name: bob
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io
But bob cannot list pods in the namespace. What is the likely problem?
medium
A. The subjects field is missing apiGroup for the user.
B. The roleRef kind should be ClusterRole instead of Role.
C. The RoleBinding must be created in the kube-system namespace.
D. The user bob does not exist in Kubernetes.
Solution
Step 1: Check subjects field completeness
The subjects entry for user bob lacks the required apiGroup field, which is needed to identify the user correctly.
Step 2: Understand impact of missing apiGroup
Without apiGroup, Kubernetes cannot match the user to the RoleBinding, so permissions are not granted.
Final Answer:
Missing apiGroup in subjects causes permission failure. -> Option A
Quick Check:
Subjects need apiGroup for user binding [OK]
Hint: Always include apiGroup in subjects for users [OK]
Common Mistakes:
Omitting apiGroup in subjects
Confusing Role and ClusterRole in roleRef
Assuming namespace or user existence is the problem
5. You want to grant a service account named deploy-bot in namespace dev permission to create pods across all namespaces. Which is the correct approach?
hard
A. Create a RoleBinding in each namespace binding deploy-bot to a Role with pod creation rights.
B. Create a RoleBinding in the dev namespace binding deploy-bot to a Role with pod creation rights.
C. Create a ClusterRoleBinding binding the deploy-bot service account to a ClusterRole with pod creation rights.
D. Create a ClusterRole with pod creation rights but no binding is needed.
Solution
Step 1: Identify scope needed
Permission to create pods across all namespaces requires cluster-wide scope.
Step 2: Choose correct binding type
A ClusterRoleBinding is needed to bind the deploy-bot service account to a ClusterRole with pod creation rights cluster-wide.
Final Answer:
Create a ClusterRoleBinding for deploy-bot to a ClusterRole with pod creation rights. -> Option C