Authorization diagnostics
Read the evidence first
An HTTP 401 commonly means that the presented credentials were not accepted; anonymous access can complicate missing-credential cases. A 403 commonly indicates a forbidden operation; admission can also reject writes with a forbidden response. Examine the status reason, identity and request attributes before changing policy. A timeout is not evidence that RBAC denied a request.
{ "kind": "Status", "apiVersion": "v1", "status": "Failure", "reason": "Forbidden", "code": 403, "message": "fixture principal cannot get resource pods/log in namespace book-lab"}Check the exact permission
For the catalog observer, reading a Pod works but reading its log fails. In a separately approved disposable lab, the following commands query the current lab identity, not an impersonated user. They require a preconfigured lab kubeconfig, context and relevant access-review API support. These are static examples; no commands were executed. A yes response describes the authorization decision, not an admission result or a successful application operation.
kubectl --kubeconfig ./approved-lab.kubeconfig --context book-lab-reader -n book-lab auth can-i get pods/catalog-demokubectl --kubeconfig ./approved-lab.kubeconfig --context book-lab-reader -n book-lab auth can-i get pods/catalog-demo --subresource=logMake the smallest reviewed change
The initial binding does not grant pods/log. If the owner approves log access for catalog-demo only, the proposed Role and RoleBinding add exactly that named subresource grant. It is an offline review fixture, not an instruction to apply it to a real cluster. Pod names managed by controllers may change; a name-specific grant is useful for this stable synthetic Pod but is not a label-based policy. Logs can contain sensitive data, so approval and redaction are still required.
apiVersion: rbac.authorization.k8s.io/v1kind: Rolemetadata: name: catalog-log-reader namespace: book-labrules:- apiGroups: [""] resources: [pods/log] verbs: [get] resourceNames: [catalog-demo]---apiVersion: rbac.authorization.k8s.io/v1kind: RoleBindingmetadata: name: catalog-log-reader namespace: book-labsubjects:- kind: ServiceAccount name: catalog-reader namespace: book-labroleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: catalog-log-readerVerify both allowed and denied outcomes
Compare the original and proposed policies. The named log becomes readable in the model; another Pod log remains ungranted, and the account still cannot delete Pods or read Secrets. If a live result differs, inspect other grants and authorizers with the cluster owner, verify the context and check roleRef and subjects. Changing a binding roleRef requires a reviewed replacement because that field is immutable. Removing one binding may not remove access granted elsewhere.
Before: get pods/log catalog-demo -> no matching grantAfter: get pods/log catalog-demo -> allowedAfter: get pods/log other-demo -> no matching grantAfter: delete pods catalog-demo -> no matching grantAuthorization is not admission or runtime success
A positive access review does not promise that a write passes schema checks, admission, quota or application health tests. Record which stage produced the rejection, and keep evidence of positive and negative checks. Review sensitive rights such as Secret access and role administration separately; never request blanket admin simply to clear a failing test. Use diagnostic-cases.json and the offline validator to compare observed evidence with the next safe action.
identity verified -> permission checked -> admission checked (if applicable) -> operation result verifiedCheck Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Authorization diagnostics — knowledge check
Interpret synthetic identity and permission evidence.
A valid principal receives a forbidden pods/log response. What should be checked first?
What does a positive auth can-i result prove?
Which permission matches reading a named Pod log?
What should happen after a narrowly scoped grant is reviewed?
Does removing one binding always revoke access?