Read-only access for an on-call team
Let a team see production, its snapshots and its drift, with a custom role granted on the production environment, and change nothing.
The situation
The sre-oncall team is paged when production breaks. They need to look at it: which deployments are unhealthy, which snapshot is running, what drifted, what the pods say. They must not be able to sync, restore, revert drift, ignore a field, change a setting or open a terminal. Nobody else's environments should appear to them either (Who sees what).
Wardn gives read access by a grant: a role given to a team on a place, which reaches everything in the place. Wardn has no "deny", so read-only means a role that holds only reads, granted on production and nowhere else. The built-in Organization reader is wider than you want: it reads the whole organization, the full Activity feed included, and only an Owner can grant it (Roles and grants).
Repository layout
Nothing in git changes. This recipe is access, and it lives in Wardn: one custom role, one team and one grant.
| Piece | Where it lives |
|---|---|
The role Production reader | Access › Roles |
The team sre-oncall | Access › Teams |
The grant of the role to the team on production | The role's page, Grant this role |
Settings
The role
Read the permission list first, from GET /permissions or the role editor. What on-call needs, and what each key reads (API permissions):
| Permission | What it lets them see |
|---|---|
environment:read | The production environment and its settings. |
cluster:read | Its clusters, their health, nodes and operator. |
app:read | The apps that run there. |
deployment:read | Each deployment's state, settings, resources, pods, logs, events, drift, diffs and timeline. |
snapshot:read | The deployment's snapshots, history and the restore preflight, so they can see what a restore would do, though not run it. |
A custom role never holds more than its creator, and reads are always allowed, so an Admin can make it.
Open Access › Roles and choose New role.
Under Details, name it Production reader and describe it: "Reads production and changes nothing". Under Start from, choose Blank.
Under Where it is granted, choose On a scope. A grant of it then names an environment, cluster, app or deployment.
Under Permissions, tick environment:read, cluster:read, app:read, deployment:read and snapshot:read. Tick nothing else.
Choose Create role.
The team
Open Access › Teams and choose New team. Name it sre-oncall (up to 48 characters), pick who joins and choose Create team. You become the team's owner and first member. A team keeps at least one owner, so make one of the platform team the owner and then step down, rather than trying to leave an empty team.
Then open the team and, under Members, choose Add members to add the on-call engineers as plain Members. Membership comes from the sign-in service, so the API creates the team (POST /teams with {"name": "sre-oncall"}) but has no call to add a plain member.
Add people as plain members. A Viewer can be one, and is the strictest choice: a Viewer is refused everything that does not end in :read, whatever they are granted. Do not make anyone on the team a lead or owner; leads can add and remove members, and owners decide who may act for the team.
The grant
Open the Production reader role under Access › Roles and choose Grant this role.
Pick the Role, then under Who gets it choose the team sre-oncall. The dialog checks each person and tells you if someone cannot hold the role.
Under Where, choose An environment and pick production. The dialog says: "A grant on an environment reaches its clusters, ones added later too."
Leave Expires empty for a standing rota, or set a date if the team rotates. Choose Grant role.
A grant on production reaches the environment, its clusters, and the deployments placed on the environment or on those clusters, so a cluster added to production later is covered with no further step. It reaches nothing else: the team does not see staging, or the names of other teams' apps.
Reading is not the whole story: team membership also gives rights
The grant only adds reading. It takes nothing away. A person who is also a member of the team that owns an app holds Team member on it, and that role syncs and rolls back that team's deployments, production included. If sre-oncall owns no apps and its members are in no team that does, the setup is read-only. Someone who is in payments as well keeps what payments gives them. To make a person read-only everywhere, make them a Viewer and keep them out of app-owning teams (Members and teams).
What the team leaves out on purpose, and why:
- A terminal. A terminal follows deploy access, so a role that only reads cannot open one. Give on-call
pod:execseparately, with a role that names it, if they should have a shell, which is also how they open one in an environment set to named people only (Terminal). audit:read. It reads the whole Activity feed. Without it, on-call reads the entries about what they can see. Add it only if they need every entry.guardrail:read. It shows guardrails, exceptions and freezes. Add it if on-call must know why a deploy is held.
Logs can contain secrets an app printed by mistake. deployment:read includes logs, so give this role to people you would trust with them.
Check that it worked
Check each person's access as the person who manages members (org:read), before the first page:
# Everything this person can do, and where it comes from.
api "$WARDN_API_URL/api/v1/members/$USER_ID/access"
# What they can do on one production deployment.
for p in deployment:read snapshot:read deployment:sync deployment:rollback drift:revert drift:ignore deployment:manage pod:exec; do
printf '%-22s' "$p"
api -X POST "$WARDN_API_URL/api/v1/members/$USER_ID/can-i" \
-d '{"permission": "'"$p"'", "scope": {"kind": "deployment", "id": "'"$PROD_DEPLOYMENT_ID"'"}}' | jq -r .allowed
doneYou should see true for the first two and false for the rest. To see who else can act on a place, and why:
api "$WARDN_API_URL/api/v1/access?kind=environment&id=$PROD_ENV_ID"That needs role:read on the place. Then ask the person to sign in and look. They should see only production: its deployments, clusters and apps, each deployment's Snapshots and Drift tab. On Drift, the choices Adopt, Revert and Ignore field are disabled, each saying which permission it needs, for example "Needs the drift:revert permission". Sync, restore and the settings are refused with 403 naming the missing permission; anything outside production answers 404, as if it did not exist. From their own terminal, wardn can-i deployment:sync --scope deployment --on "$PROD_DEPLOYMENT_ID" answers no.
End the cover
When the rota changes, remove the person from the team, or revoke the grant from the role's page ("Grant revoked") or with DELETE /role-bindings/{id}. Both take effect at once. A grant with an Expires date lapses on its own, which suits temporary cover such as a contractor.
Next
Roles and grants
Built-in roles, custom roles and the rules for giving access.
Who sees what
How teams, grants and ownership decide what each person can read.
Deploy from CI with an API token
The same least-privilege idea, for a job.
Related: Members and teams, Access model, Drift.
Deploy from CI with an API token
Make an API token that can only read one environment, and a CI job that waits until a commit is running there and healthy, with a complete script.
Ask the release agent in a team channel
Let the Payments team ask a release agent what is running and what failed, from a private Slack channel, with a binding that reads only what they may read.