AI agents¶
An AI agent such as Claude Code or Cursor can work on your clusters through kubelatch's MCP server. It connects to one address, you authorize it in your browser, and it acts as you with only the permissions you choose, for a few hours. kubelatch records every call it makes, can hold its changes until you approve them, and lets you cut it off at any moment.
Why not give it your kubeconfig¶
Say you're developer on shop and you ask your agent "find out why the web pod is failing". Without kubelatch you have two bad options: give it your kubeconfig, and it can do everything you can while the audit log shows only you; or ask an administrator for a bot and wait, which nobody does for a ten-minute task.
kubelatch adds a third: you authorize the agent yourself. It's the gesture of Sign in with Google: you don't hand over your password, you give a limited permission you can take back.
| Your kubeconfig to the agent | Bot | Delegated | |
|---|---|---|---|
| Who sets it up | You, at once | An administrator | You, at once |
| What the agent can do | Everything you can | What the administrator decides | What you can, cut down; read-only by default |
| What the audit log shows | You | The bot | You, through the agent |
| How long it lasts | As long as your credential | Up to 90 days | Hours |
Connect your agent¶
-
Once, add kubelatch to your agent. On Home, Connect an agent shows the command with your kubelatch's address. For Claude Code:
claude mcp add --transport http kubelatch https://kubelatch.example.com/mcpFor Cursor, in
.cursor/mcp.json:{ "mcpServers": { "kubelatch": { "url": "https://kubelatch.example.com/mcp" } } }Any other MCP client: Streamable HTTP at that address; it signs in with OAuth. With Claude Code you can install the plugin instead, which adds the server and the rules for the agent.
-
The first time the agent uses kubelatch, your browser opens on kubelatch, where you're already signed in (if not, sign in and it brings you back).
- You see Let Claude Code act as you? (with the agent's name), over Who asks: the Agent, the site the browser Returns to after you answer, and how long the request lasts. Under What it gets · until when are your permissions, grouped by cluster. For each one, choose what the agent gets with the three buttons beside it: Leave out, Read only (viewer) or Same role (…); All read only and All as me (no cluster-admin) set them all at once. Under them, Permissions you get later has the same three buttons (Leave out, Read only (viewer) and Same role), set to Read only (viewer); All read only and All as me (no cluster-admin) set it too. Then the Duration (8 h unless your administrators changed it) and whether Writes need my approval (on). A sentence above the buttons sums it up, for example "Claude Code acts as you with 2 permissions for 8 h, and what you get later as read only; each write waits for your approval." Click Authorize.
- The browser tells you Authorized. Go back to the agent. The agent carries on.
On that page:
- Read only (viewer) is offered, and chosen for you, only for a permission whose role includes
viewerwithout being it:developer,adminandcluster-admin. Aviewerpermission comes as Same role (viewer), chosen for you. Adebuggerorsecrets-readerpermission, or one of a custom role, can only be passed as itself, and it comes set to Leave out: choose Same role (…) only if the agent needs it. You include at least one permission. cluster-admincan only be passed as Read only (viewer): an agent never inheritscluster-admin.- A name the agent gives itself is marked unverified: kubelatch has not checked it. An agent that publishes its identity shows published by …, with the site that publishes it.
- The line right above the buttons says where your answer goes. For an agent that only returns to your own computer it is This agent runs on your computer. Authorize it only if you just connected it yourself.; for one that has other addresses but returns to this computer this time, This agent gets your answer at …, on this computer. Authorize it only if you just connected it yourself. Both are quiet reminders. Any answer that goes anywhere else raises a highlighted warning: This agent gets your answer at …, off this computer. Authorize it only if you know that address and just connected the agent yourself., or, when it goes to an app that opens its own links (such as
cursor://), This agent gets your answer through whatever app opens … links on this computer, and that app can pass it on. Authorize it only if you just connected the agent yourself from that app. If you didn't just connect one, click Deny. Which addresses an agent may use is in Signing in (delegated agents). - If the time runs out before you answer, the buttons give way to This consent no longer works: go back to the agent and connect it again.
- A permission you hold in two ways, directly and through a group, is one row, marked via group … when a group gives it. Your choice applies to every way behind the row.
- Permissions you get later is what happens when you receive a permission after authorizing the agent, directly, in a batch or by joining a group. Read only (viewer) gives the agent
viewerthere, Same role the same role, and Leave out nothing. The agent has it from its next call, without connecting again, and loses it when the session or your permission ends. Read only applies only to a role that includesviewer; adebugger,secrets-readeror custom-role permission you get later passes only with Same role; andcluster-adminnever passes as itself, but asviewer. The session's page shows your choice as Later permissions.
What the agent sees and does¶
- Clusters see you,
user:<your login>, but only with the permissions you gave the agent. What its role doesn't allow, the cluster refuses with a403, even though you could do it. - It has tools to read (list objects, read one, describe one with its events, logs, events, rollout status, CPU and memory usage, Secret values), to change (apply an object, delete one, scale, restart a rollout) and to ask for more access. MCP server lists them. Every agent sees the tools that change things, whatever its role: a change its role doesn't allow gets the cluster's
403, and it can ask you for more withrequest_access(see below). - Secret values stay hidden unless the agent asks for them on purpose, and each such read is recorded.
- Ask it to call
whoamito see what it can do, where, and until when. - You follow what it did in Agents: each session has a timeline with every call. If an administrator looks at the audit log, your agent's requests show as yours, through the agent.
What it will ask you to approve¶
When you include a role that writes, such as Same role (developer), and keep Writes need my approval on, every change the agent wants waits for you, and you see it before it happens:
- The agent gives you a link,
https://kubelatch.example.com/agents/requests/…. Agents in the sidebar shows how many approvals wait for you, and so does the bell: when only one waits, it says what the agent asks ("Claude Code wants to changedeployments.apps/scale/checkoutinapps(prod)") and opens that approval; when several do, it counts them and opens Waiting for you. On Home, Pending says the same, with Review. - The page is titled with the change in a sentence (for example "deploy-bot wants to change configmaps/feature-flags in apps (kind-local)") and says who asked and how long is left. A line sums up what the change does ("Changes 2 lines of data"), and Changes shows the object now against what the cluster says it will become, lines that go with
−and lines that come with+. The metadata the server manages comes folded. Secret values stay hidden, and one the write changes reads<redacted, N bytes, changed>. - Click Approve or Deny; on a phone the two buttons stay at the foot of the screen. Each asks you to confirm with the sentence of the change. Once approved, the write runs once, exactly as you saw it. The page then says what became of it: "Approved by alex at 17:21 · ran once, the cluster answered 201."
You often don't have to carry the link (Pages that open by themselves). Decide on the page, and the agent's call goes on by itself and returns the result, whose first line says "approved by alex at …". Otherwise the agent gives you the link in text and calls again with the approval_id; that call waits for you as well. A call waits for your decision for about a minute at a time and the approval stays open: the agent calls again, or goes on with something else and comes back.
In Agents, each approval in Waiting for you has Approve… beside Review, with the time it has left ("expires in 4:12") and your agent's reason in quotes. Approve… asks the same confirmation as the page, with the sentence, the reason, what the change does and the time left, so you can approve without opening the page. Review opens the page to read the whole diff first.
When an agent has left several writes of one shape, they wait as one item: Approve 3… approves them all after one confirmation, Review unfolds them, and its menu has Deny 3…. For a mix, press Select in Waiting for you, tick the items and use Approve N or Deny N in the bar that the first tick brings up under the list, where Select all (N) ticks every one: one confirmation decides them all, or none. A batch of approvals holds writes of one shape only, the same agent, cluster, tool, resource and namespace, so it reads as one sentence ("ops-agent wants to delete 16 jobs.batch in shop"), with each object and what its change does listed under it; anything else is still approved one by one, with its diff. A batch of denials takes anything you can decide. The audit keeps one decision per approval, each marked with the batch it was taken in.

A write waits 15 minutes for you; once approved, the agent has 15 minutes to run it.
When it needs a role¶
For a task with several changes, or one its role doesn't allow, the agent asks for a role for a while with request_access, with a reason: for example developer on shop for 30 minutes, for at most 8 hours. A 403 already tells it which role to ask for. What comes next depends on what you hold:
- The agent already has that role there: it carries on.
- You hold that role there: the agent asks you to approve it, on the same kind of page as a write, with the role, where, for how long and its reason. While it lasts, the agent's writes there don't ask you one by one. If you hold the role on the whole cluster only, the agent asks again for the whole cluster.
- You don't hold it: you ask for it first. In Pro, the agent opens the request form with the cluster, the namespace, the role and its reason filled in, and under Reason the form says "Your agent Claude Code proposed it. Change it if it does not say what you want." Choose for how long and send it: the owners of the place or an administrator decide, or the cluster's environment grants it at once. In Free, the agent tells you whom to ask.
An agent never gets cluster-admin, and can't ask for a native role.
Meanwhile the agent waits for you, about a minute per call, and calls again or goes on with something else. When you have the role, it goes on by itself: with Same role under Permissions you get later, the agent has it at once; with Read only (viewer), the default, or Leave out, the approval of the role opens, as when you already hold it, and one click gives it to the agent. If the request is denied, the agent tells you who denied it and their note, and doesn't try another way. If nobody decides within an hour, the agent's ask lapses, and it asks again if it still needs the role.
The whole path, with the plugin in VS Code and Same role:
- You ask the agent to create a test Job in
shop. Itsapplygets a403: thedeveloperrole inshopallows it. - The agent calls
request_access, and the request form opens, filled in. You click Ask for developer in shop for 2 h. - An owner approves it, or the environment grants it. The agent's call, which was waiting, answers that it has
developerinshop. - The agent calls
applyagain, and the approval of the write opens. You click Approve, and the Job is created.
Your two clicks are the two decisions; the agent does the rest.
Pages that open by themselves¶
When a call waits for you, the page you decide on comes to you:
- In Claude Code's VS Code extension, with the plugin, the approval page or the request form opens in your browser by itself.
- In Claude Code's terminal (its default runtime since 2.1.274, with or without the plugin), the client shows what waits in a sentence and asks to open the page in your browser. If you decline, the agent gives you the link.
- Any other client, or a session over SSH or without a display, shows you the link.
How much it bothers you: the browser opens once per session, like kubelatch login, and then only for what needs your decision. Read-only work asks nothing.
Cut it off¶
The session ends by itself when its duration runs out. Before that, in Agents, click Cut on its row in Your agents (or open the session and click Cut there): its tokens are revoked, its pending approvals are closed, and the permissions you gave it end. Its next call fails. Connecting it again asks you again.
If one of your permissions is revoked or expires, the agent loses what came from it at once.
Your team's agents¶
An agent that isn't yours, such as an on-call agent that reviews alerts at night, uses a bot that an administrator creates, with the permissions the administrator grants it (AI agents for administrators). It and your own agent don't touch: your Claude Code acting as you, read-only, and bot:ops-agent, viewer on every namespace, are two identities.
The Claude Code plugin¶
The plugin kubelatch adds kubelatch to Claude Code together with the rules that make it use kubelatch:
claude plugin marketplace add picaportelabs/kubelatch
claude plugin install kubelatch@kubelatch
When the plugin is enabled, Claude Code asks for kubelatch URL: your kubelatch's address, such as https://kubelatch.example.com, without /mcp. You can change it later in /config. Then the agent signs in as in Connect your agent. Don't also add the server with claude mcp add: the agent would see it twice.
The plugin brings:
- the kubelatch MCP server;
- the skill
kubernetes-via-kubelatch: use kubelatch's tools for everything on Kubernetes, start withwhoami, a403is an answer, and how approvals go; - a hook that refuses
kubectl,helmandk9scommands that reach a cluster, andkustomize build | kubectl, and tells the agent which tool to use instead. Commands that don't reach a cluster, such ashelm template,kustomize buildorkubectl kustomize, still work; - a hook that opens the approval page or the request form in your browser when a call of the agent starts waiting for you, once per wait. It opens on Linux and macOS, in the VS Code extension and wherever Claude Code runs outside its interactive terminal; never in the terminal, which asks you itself, over SSH or without a display. It opens only a page of the kubelatch URL you gave the plugin, so set it to the address kubelatch's links use. To turn it off, set Open approval and request pages in your browser (
open_approvals) to off in/config; the agent then gives you the link.
To teach the agent your own routines, integrations/examples/skills/ has three example skills built on kubelatch's tools: incident triage, read-only database diagnostics through a one-off Job, and a check after a release. Copy one into your project's .claude/skills/ and adapt it; the names in them are placeholders.
For other agents, the same rules are in integrations/rules/: paste kubernetes-via-kubelatch.md into your project's AGENTS.md (Claude Code reads AGENTS.md only when there's no CLAUDE.md; otherwise paste it into CLAUDE.md), or copy kubelatch.mdc to .cursor/rules/ for Cursor.
The hook is a guardrail for an agent that means well, not a boundary
What you give the agent limits what it does through kubelatch. If it has another way into a cluster on your computer, such as a kubeconfig or a kubelatch login session, it can use it, and kubelatch can't see it. The plugin's hook refuses the usual commands in Claude Code, but it can be bypassed; rules in AGENTS.md or in Cursor only ask. Keep other kubeconfigs out of the agent's reach.