Manage roles¶
A custom role is a set of permissions you compose from capabilities and, when needed, advanced rules, and then grant like any system role. Here's how to create, duplicate, edit, delete and grant one in Roles. What a role can hold, what kubelatch refuses and why are in Roles. A native role is the other kind you can create: it names groups the cluster already knows, and kubelatch writes nothing for it.
Roles is in the sidebar, next to Permissions, for administrators only.
Before you start¶
- The administrator role in kubelatch.
- To grant a custom role on a cluster, the cluster runs the current bootstrap manifest. A cluster registered before custom roles existed says Bootstrap v1: custom roles cannot be granted on this cluster. in Needs attention, on its page in Clusters: update its bootstrap first. You can create the role before that.
Custom roles are a Pro feature: in Free, the six system roles are available and Roles says so. A lapsed or removed key keeps existing custom roles working; they can be deleted, not created or edited, and Roles says so while any exist. See Editions and license. Native roles are in every edition and don't count among the custom roles.
The Roles page¶
Roles is the catalogue of every role, as an IAM console lists them. Its first line counts them by type and says what deserves a look: 10 roles: 6 system, 3 custom and 1 native. 2 unassigned; 1 with no activity in 30 days. The tabs All, System, Custom and Native keep one type; the search box finds a role by its name, id or description, or a native role by its groups; the filters keep the roles unassigned, those with no activity in 30 days (Pro) and those with never-ending permissions, each with how many it keeps, and they add up.
| Column | What it shows |
|---|---|
| Role | The name, which opens the role's page, the identifier of a custom or native role, and its description on one line. admin and cluster-admin are in bold. |
| Type | System, Custom or Native, with its icon. |
| Assigned on | Namespaces, Namespaces and whole cluster or Whole cluster, as the builder says them, and its limits under it: only some clusters, a maximum duration (cluster-admin, 8 h), needs PSA. |
| Assigned to | Who holds it: the first holders' avatars, then how many people and bots, on how many clusters and through how many groups, and N never end when some hold it with no expiry. Its link opens Permissions filtered by the role. Unassigned when nobody holds it. |
| Last activity | In Pro, the role's requests over the last 30 days as a small line, and when the last one was; No activity in 30 days when it is held but nobody used it. In Free, the audit keeps 24 hours: the last request of those 24 hours, or No activity in 24 h. |
| Modified | Who created or last changed a custom or native role, and when. |
A request counts for a role when it went to the cluster with that role's group: the whole-cluster one, or the one of the request's own namespace. The row menu has Open, View in Permissions, Duplicate (all but admin and cluster-admin) and, for custom roles, Edit and Delete. On a phone each row keeps the type's icon, the name and a line with the type, how many accounts hold it and the last activity.
The Sensitive badge is on the role's page and in the builder, not in the list (Risk and Pod Security).
Open shows the role as a page: its figures, What it grants, Who holds it, Where it applies and its summary with the YAML, with Duplicate, Edit and Delete in the header. Who holds it, for administrators, lists every active permission of that role by cluster, admin and cluster-admin included, with the account, where, until when and why, each with its menu (Read a permission); a role nobody holds says Nobody holds this role now. The command palette (⌘K) also has New role and every role by name.

Create a role¶
- In Roles, click New role. The builder opens as a page: on the left, what you compose, in the order of the decisions; on the right, on a wide screen, what the role grants in the Summary and YAML tabs. On a phone the summary is a bar at the bottom of the page with the risk, "N resources · M problems" and Summary, which opens it in a panel.
-
Under Role, choose where to Start from: Blank, one of
viewer,developer,debuggerandsecrets-reader, or one of your custom roles. The chip copies that role's capabilities, rules and scope, and a line under the chips names the start; a copy ofviewerordeveloperis an approximation (Duplicate a role). If you had already composed something, the builder asks before replacing it. Then fill in:Field What to put Name What people will read in the lists, up to 80 characters. Identifier Shown under the name and derived from it: 2 to 39 lowercase letters, digits and hyphens. Click Change to type your own. It can't change once the role exists, and is never used again. Description One line about what the role is for. People holding it see it on their Home. -
Under Where it applies, choose Namespaces (granted on one namespace at a time; every capability is available) or Namespaces and whole cluster (also grantable with scope
*; the role reads only, never Secrets, and reacheskube-systemandkubelatch-systemtoo: why; its advanced rules may still write cluster objects). Decide it first: it fixes which capabilities are available. Under Clusters, keep Every cluster or choose Only some… and tick them. - Under Capabilities, tick what the role needs, domain by domain. Search capabilities filters by name. What the scope rules out folds into one line per domain: with Namespaces, the cluster-wide capabilities, with Change to switch the scope; with the whole cluster, the capabilities that write or read Secrets. A ticked capability that stops fitting after a scope change stays visible and marked, and a line at the top offers to switch them all off at once. Ticking a write capability without the read one it presumes (Write ConfigMaps without Read ConfigMaps) shows a note:
kubectl editandkubectl applyneedget. Its button adds the read; the role saves either way. - Under Advanced rules, only for what no capability covers, click Add rule. Each rule has an API group (type one, or pick Core group for Pods, ConfigMaps and the rest of the core), Resources (type each and press Enter), Verbs (press the chips, or Read and Write for the usual sets) and, optionally, Names (optional). Suggest from cluster reads a ready cluster's API and offers its groups, resources and verbs in those fields; a verb the cluster doesn't serve for the chosen resources is drawn dashed. Without a ready cluster, type groups and resources by hand. With Namespaces and whole cluster, a rule writes only the cluster objects of an API group outside Kubernetes: the write verbs of any other rule are disabled, and a resource the suggesting cluster serves inside namespaces is marked under the rule.
- Read the summary, which is kubelatch's own reading of the draft: what to fix, What it grants in words, Look twice, Requirements, the resources table with Read, Create, Update and Delete (folded at eight rows), and Impact of saving. A problem shows next to its field, and under To fix before saving as a link to it, once you've touched that field or tried to save; under Create role, a line says Valid: nothing to fix or how many problems are left.
- Click Create role. Roles opens with the notice "Role "…" created.".
A new role grants nothing until you grant it to someone (below).
Example: deploy with Argo CD, no Secrets¶
A team that deploys through Argo CD needs to see its workloads, restart them and read its Argo Applications, without Secrets:
- Capabilities: Read workloads, Scale, Delete Pods, Read logs, Read events.
- An advanced rule: API group
argoproj.io, Resourcesapplications, Verbs Read (get,list,watch).
The summary marks it Sensitive, because argoproj.io is a group outside Kubernetes (What kubelatch can't know), and it requires no Pod Security: nothing in it creates pods.
Four more, for what the system roles leave out (a developer who writes Secrets, a Helm bot, third-party custom resources and kubectl debug under Pod Security), are in Role recipes.
Duplicate a role¶
To start from an existing role, pick it under Start from in the builder, or choose Duplicate in its row menu or on its page: both open the builder with that chip pressed, the same content, and " (copy)" after its name; change the name and the identifier follows.
admin and cluster-admin bind Kubernetes' own roles and can't be duplicated. A copy of viewer or developer is an approximation, and the line under the chips says so: those two also aggregate Kubernetes' view role and the labelled ClusterRoles of each cluster, which a copy doesn't inherit (System roles as capabilities). Check the copy against what the person needs before granting it in place of the original.
A copy of viewer keeps Namespaces and whole cluster, because its cluster-wide capabilities need it. For a namespace-only reader, choose Namespaces: the four cluster-wide capabilities stay ticked and marked until you switch them off, which Switch off the 4 does at once.
Edit a role¶
- In Roles, choose Edit in the role's row menu, or Open it and click Edit.
- Change what you need. The identifier is fixed.
- Click Save changes. It waits for the summary to reflect what's on screen.
If no permission uses the role, it's saved at once. If some do, kubelatch asks first: Save role "…" says how many permissions on how many clusters change, and lists Capabilities added, Capabilities removed and, if so, The advanced rules change. On Save, those clusters are reconciled right away: within seconds the holders have the new rules, with the credentials they already have.
kubelatch refuses an edit that would leave active permissions the role no longer allows:
| Edit | What to do |
|---|---|
Choosing Namespaces under Where it applies while it's granted with scope * |
Revoke those permissions first. |
| Taking a cluster out of Only some… while it's granted there | Revoke the permissions on that cluster first. |
| Making the role start requiring Pod Security while it's granted on namespaces | Revoke those permissions and grant them again: granting checks each namespace's label, an edit can't. |
The summary says these before you save: the whole-cluster card, the cluster's box or the capabilities show the problem with the number of permissions, and Against the stored role lists No longer grantable to a whole cluster. or Removes the clusters: …; the confirmation repeats them. A permission granted between the summary and the save is still refused on saving, with the same message.
Permissions on a set never block an edit. Where the edit leaves the role not allowed on a cluster of the set, the permission stops reaching that cluster and keeps working on the others; the confirmation lists it, for example 2 permissions on team: payments stop reaching prod-eu. (Permissions on a set).
These count the permissions of disabled accounts too, which Usage leaves out. Find them in Who holds it, on the role's page, dimmed and marked Account disabled: the permission counts for nothing while it stays so.
If someone else saved the role after you opened it, saving says Someone saved this role after you opened it. Click Load the latest version: your changes stay on screen, the summary shows how they differ from the saved version, and you save again.
Every edit is a role.update in the control plane log, with the revision before and after, the capabilities added and removed, and the rules before and after (Audit and retention).
Delete a role¶
- In Roles, choose Delete in the role's row menu, or Delete on the role's page.
- Delete role "…" checks which permissions use it:
- None: click Delete.
- Some: the dialog lists every active direct permission, those of disabled accounts included, and every group permission that names the role, as group SRE nightly · prod · payments · no members or · 3 members; a permission a group gives is read through its group, not one by one. A permission on a set of clusters is listed once, however many clusters it reaches, as alice · environment staging · whole cluster or group SRE nightly · label team: payments · payments. It offers Revoke all and delete, which revokes them and deletes the role in one step, with the permissions derived from those group permissions, so no group gives it again; their clusters are reconciled at once.
The identifier is never used again. Past permissions and the audit log keep the role's identifier, and the lists show it in place of the name. System roles can't be deleted.
Grant a custom role¶
In Permissions, Grant permissions works as for a system role (Grant permissions). Under What, System roles come first and Custom roles after. A custom role is disabled when the chosen cluster can't take it:
| Next to the role | Why | What to do |
|---|---|---|
| (the cluster needs re-enrolling) | The cluster has the previous bootstrap manifest. | Update the bootstrap. |
| (not available on this cluster) | The role is limited to other clusters. | Grant it on one of those, or edit Where it applies. |
The same rules as for a system role apply: no protected namespace, the namespace must exist, and a role that requires Pod Security needs the pod-security.kubernetes.io/enforce label set to baseline or restricted. Scope whole cluster (*) only works for a role that can be granted to a whole cluster. A custom role has no expiry limit, so Never is available.
On the cluster, the permission is the group kubelatch:ns:<namespace>:role-<id>, or kubelatch:cluster:role-<id> for scope *. To check what it allows, use kubectl auth can-i with that group (Check what someone can do).
Native roles¶
A native role names one to 20 groups that a cluster's own sign-in (its SSO) already knows, such as oidc:developers. A permission of that role is temporary membership in those groups: while it lasts, the proxy sends them as Impersonate-Group, and the bindings the cluster already has for them apply. kubelatch writes no binding and no ClusterRole for it. Why and when to use one is in kubelatch on top of the SSO you already have; which groups each provider gives is in Cluster SSO by provider.
What sets a native role apart:
- The cluster decides the scope. It is always granted on the whole cluster (
*); what it reaches is what the cluster's bindings give its groups, in one namespace or in all of them. - Always sensitive. kubelatch can't know what a group of the cluster allows, so the role is marked Sensitive and its page has no YAML.
- Forbidden groups. Names that start with
system:(system:masters,system:authenticated…), which the apiserver treats as its own, and withkubelatch:, which are kubelatch's own groups. A name takes 1 to 253 bytes, with no spaces or control characters, and each group goes once. - The 8-hour rule. If the cluster gives one of the role's groups privileged access, every permission of the role there needs an expiry of 8 hours at most, as the
cluster-adminrole does (below). - The class is fixed. A native role can't become a custom role, nor the other way round: create a new one.
- Every edition. Native roles are in Free too, and don't count among the custom roles. An instance holds up to 200 of them.
- Agents never get one. Neither a delegated agent nor an agent's access request can receive a native role (AI agents).
Create a native role¶
- In Roles, click New role. Under Role, in Class, press Native: groups the cluster already knows. Capabilities and advanced rules go away (they come back if you press Custom again), and so does Start from: a native role copies nothing.
- Fill in Name, Identifier and Description as for any role. The cluster names many groups by an id or a prefix; the name and the description are where you say what the group is.
- Under Where it applies, keep Every cluster or choose Only some…: a native role is useful on the clusters whose SSO uses those group names. There is no scope to pick.
- Under Cluster groups, add the groups:
- Known in picks a ready cluster, and the list below shows the groups its bindings name, each with what it is bound to and Add. A group with privileged access carries the privileged pill; a
system:group shows as forbidden; kubelatch's own groups aren't listed. - Type a name by hand takes a group the cluster doesn't know yet, such as one you are about to bind; Enter adds it.
- The chosen groups show above as chips, each with its ✕, and a counter of up to 20.
- Known in picks a ready cluster, and the list below shows the groups its bindings name, each with what it is bound to and Add. A group with privileged access carries the privileged pill; a
- Read the summary: Sensitive, Scope: the cluster decides, the
Impersonate-Groupthe role sends, and under Look twice each cluster where one of its groups has privileged access, with the 8-hour rule, or a cluster that couldn't be read. - Click Create role.
The picker reads what the cluster knows as What this cluster knows does on the cluster's page (Register a cluster), from a read that kubelatch keeps for five minutes.
Grant a native role¶
In Permissions, native roles have their own section, Native roles, after Custom roles, each with the cluster groups it sends under its name; About native roles, under the list, leads here. Choosing one fixes the scope to Whole cluster and says which groups it sends. The cluster has to run the current bootstrap manifest (Update the bootstrap) and be one the role applies to.
Before you send it, the form asks kubelatch what the cluster allows. If a group of the role, or the name the cluster gives that person (Identity in the cluster), has privileged access, An expiry is required and 8 h at most show with the reason, and the expiry is capped as for cluster-admin. Granting reads the cluster's RBAC again, live: a cluster that can't be read refuses the permission, and an expiry beyond 8 hours answers grant.privileged_ttl. The same rule applies to any role, system and custom ones included, when the name the cluster gives the person has privileged access, and to the roles kubelatch writes on a privileged namespace.
As a group permission, a native role whose group has privileged access is refused, and so is a role kubelatch writes on a privileged namespace: every future member would inherit it with no check. Once you choose the cluster, the group's form shows that native role disabled, with the reason under it: This cluster gives privileged access to oidc:sre: grant it to each person, 8 h at most. While the cluster can't be read, every native role is disabled with Could not read the cluster., and Read again, under Native roles, asks it again. Granting checks the cluster again, and a role the cluster made privileged in the meantime is refused with A group permission cannot do this. Grant it to people one by one, with an expiry.
Every 10 minutes, and on every change, the reconciliation reads the cluster's RBAC again. A group with privileged access that some active permission gives without an expiry of 8 hours at most from when it was granted, or that a permission inherited from a group or a permission on a set gives at all, stays out of what the proxy may impersonate, and the cluster goes to Error with privileged: the group … gets … and the grant of … has no 8 h expiry, … and a group permission of … gives it or … and a permission on a set of … gives it. That catches a binding someone adds after the grant.
The role's page¶
Open on a native role shows, for administrators, Cluster groups: for each ready cluster the role applies to, each of its groups with what the cluster binds it to, the privileged pill where it has privileged access, This cluster does not know this group. for a group no binding names yet, and not read for a cluster that couldn't be read. Read again reads the clusters at once.
Edit or delete a native role¶
Editing works as for a custom role (Edit a role), with Cluster groups in place of capabilities and rules, and The class is fixed since the role was created. under Role. If the role is a group permission on some cluster, adding a group to which that cluster gives privileged access is refused, for the same reason as granting it to a group.
Deleting works as for a custom role (Delete a role). Nothing is left on the clusters: kubelatch had written nothing for it.
What someone without the admin role sees¶
People and bots without the admin role don't see Roles. On Home, under My clusters, each permission's line names its role, a custom role by its name; clicking the role shows its description. Through the API, any session can read the roles, their capabilities, rules and risk, but not their usage or the clusters they are limited to (HTTP API).