k8s-rbac-troubleshootinglisted
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