Create RBAC Role and RoleBinding to grant least-privilege access within a namespace

domain: kubernetes.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a `Role` manifest in the target namespace listing only the required `apiGroups`, `resources`, and `verbs`
  2. Avoid using wildcard `*` for verbs or resources; enumerate only what is needed (e.g., `get`, `list`, `watch` for read-only)
  3. Create a `RoleBinding` referencing the Role and specifying the `subjects` (ServiceAccount, User, or Group)
  4. Apply both manifests and verify with `kubectl auth can-i <verb> <resource> --as=system:serviceaccount:<ns>:<sa> -n <ns>`
  5. For cross-namespace access, use a `ClusterRole` bound with a namespace-scoped `RoleBinding` rather than creating duplicate roles

Known gotchas

Related routes

Configure RBAC in Apache Polaris using principals, principal roles, and catalog roles
polaris.apache.org · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans