A service account can create Pods in its namespace: kubectl auth can-i create pods, run as that service account in that namespace, returns yes. Its request to create a Pod with privileged: true is still rejected with a Forbidden error. Which stage of the API request flow rejected it?
Choose one.
Authorization decides whether an identity may perform a verb on a resource; admission control decides whether the specific object is acceptable.
kubectl auth can-i asks the authorizers, so a yes rules out authorization: it passes through the whole chain, and authorization never inspects the Pod spec anyway. The request was authenticated too, or can-i for this identity would be meaningless and the error would be Unauthorized (401). What remains is admission control, which sees the actual object and can reject it for its content, such as a privileged security context (for example the PodSecurity admission controller).
- Note that can-i confirms the authorizer chain allows create on pods.
- Recall that authorization decides on verb and resource, never on the object's fields.
- Recall that admission control sees the object and can reject it on its content.
- Conclude that admission rejected the privileged Pod.
Exam tip: RBAC answers 'may this identity create Pods?'; admission answers 'is this particular Pod acceptable?'.
KCSA Control Plane Security: API Server, Controller Manager, Scheduler and etcd — the lesson that teaches this.