← ClaudeAtlas

k8s-rbac-troubleshootinglisted

Use when a Kubernetes request is refused by RBAC: "Error from server (Forbidden)", "User ... cannot list resource ... in the namespace" or "at the cluster scope", a ServiceAccount, controller, CI job or person getting 403, a RoleBinding that does not seem to apply (wrong namespace, wrong subject, a ClusterRole bound with a RoleBinding), "is attempting to grant RBAC permissions not currently held", "roleRef ... field is immutable", 401 Unauthorized versus 403 Forbidden, or a custom resource that `view` cannot read. Investigates with kubectl auth can-i, get and describe, and proposes fixes. Reads first and asks before changing anything.
k8s-servant/k8s-skills · ★ 37 · DevOps & Infrastructure · score 83
Install: claude install-skill k8s-servant/k8s-skills
# RBAC troubleshooting Find out why Kubernetes refuses a request, and propose the smallest grant that fixes it. **Read first, ask before changing.** Run the investigation commands freely. Run a command under an "Ask first" line only after the user approves that exact command; if your credentials do not allow it, give it to the user to run. Never run a "Proposed fix"; hand it to the user. Every request is made by a **subject**: a user, a group, or a ServiceAccount, which authenticates as `system:serviceaccount:<namespace>:<name>`. RBAC allows a request only when a **binding** gives the subject a **role** whose rules cover the verb, the API group, the resource and the namespace. There are no deny rules: a 403 means that no binding allowed it. A **RoleBinding** grants its role in its own namespace only; a **ClusterRoleBinding** grants a ClusterRole everywhere, including cluster-scoped resources such as nodes and namespaces. The commands use placeholders: `my-namespace`, `my-app` (the ServiceAccount and its workload), `my-binding` and `my-role`. Replace them with the real names. The built-in `view` role cannot read Roles, ClusterRoles or their bindings; if they are forbidden, say so and ask the user for them, or work from the error message alone. Never read Secrets, and never read a ServiceAccount token, in a pod or anywhere else. ## When to use - A log or an error says `Forbidden`, `cannot <verb> resource`, or `403`. - A pod, Job or controller crashes or retries right after