All posts

Just-in-time access for AI coding agents on Kubernetes

An AI coding agent that runs as part of a continuous‑integration pipeline often receives a static kubeconfig file checked into the repository. That file contains a cluster‑admin token, giving the agent unrestricted read and write rights across every namespace. When the agent compiles code, it can also list secrets, modify deployments, or even delete services without anyone noticing. The convenience of a permanent credential masks a dangerous reality: every automated run has the same level of pow

Free White Paper

Just-in-Time Access + AI Human-in-the-Loop Oversight: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

An AI coding agent that runs as part of a continuous‑integration pipeline often receives a static kubeconfig file checked into the repository. That file contains a cluster‑admin token, giving the agent unrestricted read and write rights across every namespace. When the agent compiles code, it can also list secrets, modify deployments, or even delete services without anyone noticing. The convenience of a permanent credential masks a dangerous reality: every automated run has the same level of power, and no human ever reviews what the agent does. Teams looking for just-in-time access struggle because the agent talks directly to the Kubernetes API server, bypassing any gate that could record the exact command, hide sensitive fields, or require an approval before a privileged operation proceeds. If a bug in the code generator creates a stray exec call, the cluster can be compromised before the incident is detected.

Teams try to solve this by limiting the token’s scope or by rotating credentials nightly. Those steps reduce the blast radius but they do not change the fundamental flow. The AI agent still talks directly to the Kubernetes API server, bypassing any gate that could record the exact command, hide sensitive fields in responses, or require an approval before a privileged operation proceeds. In other words, the request reaches the target cluster with no audit trail, no inline masking, and no just-in-time check.

Why just-in-time access matters for AI agents

Just-in-time access means granting the minimum privilege needed for the exact moment an operation is required, then revoking it automatically. For AI‑driven code assistants, this model prevents a long‑lived credential from being abused by a bug, a malicious model update, or a supply‑chain attack. It also satisfies compliance teams that need evidence of who performed each action and when. The key challenge is that the enforcement point must sit where the agent cannot bypass it.

Implementing just-in-time access with hoop.dev

hoop.dev provides a Layer 7 gateway that sits between the AI agent and the Kubernetes API. The gateway runs an agent inside the same network as the cluster and proxies every request. Identity is still handled by your existing OIDC or SAML provider, so the AI agent authenticates with a short‑lived token that hoop.dev validates. Once the token is accepted, hoop.dev applies policy before forwarding the request.

Because hoop.dev is the only place the traffic passes, it can enforce several outcomes:

  • hoop.dev records each command the AI agent issues, creating a replayable session log for forensic analysis.
  • hoop.dev masks secret fields in API responses, ensuring that even if the agent receives a secret, the value is redacted before it reaches downstream processing.
  • hoop.dev requires a just‑in‑time approval workflow for any operation that exceeds a predefined risk threshold, such as creating a new ServiceAccount or modifying a RoleBinding.
  • hoop.dev automatically expires the granted privilege after the operation completes, returning the agent to a read‑only state.

The policy engine lives in the data path, so any attempt by the AI to bypass the gateway, by using a hard‑coded endpoint or an alternate client, fails because the network‑resident agent only allows traffic that originates from hoop.dev.

Continue reading? Get the full guide.

Just-in-Time Access + AI Human-in-the-Loop Oversight: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Setting up the gateway

Start by deploying the hoop.dev gateway using the Docker Compose quick‑start described in the getting‑started guide. The deployment includes an OIDC verifier, a masking plugin, and a guardrail engine out of the box. Register your Kubernetes cluster as a connection, supplying the cluster URL and a bearer token that the gateway will use internally. The AI agent never sees this credential; it only presents its short‑lived identity token.

Next, define a policy that grants the AI agent read‑only access by default and elevates to write access only when a specific workflow triggers a just‑in‑time request. The policy can reference group membership from your identity provider, ensuring that only approved AI services are eligible for elevation.

When the CI job runs, the AI agent authenticates, the request hits hoop.dev, the policy engine checks the operation, and, if the operation is within the allowed risk level, the request is forwarded. If the operation requires elevated rights, hoop.dev pauses the request, notifies an approver, and only proceeds after explicit consent.

Benefits in practice

With hoop.dev in place, you gain a complete audit trail that shows exactly which AI‑generated command touched which Kubernetes resource. The masking capability prevents accidental leakage of secrets from pod logs or API responses. Just‑in‑time approval adds a human checkpoint for high‑risk changes, reducing the chance that a flawed model update can silently alter production workloads. Because the gateway revokes the privilege automatically, the window of exposure is limited to the duration of the approved operation.

FAQ

Does hoop.dev replace my existing RBAC configuration?

No. hoop.dev works alongside Kubernetes RBAC. It adds a layer of runtime enforcement that records, masks, and gates actions before they reach the API server.

Can I use hoop.dev with multiple clusters?

Yes. Each cluster is registered as a separate connection, and policies can be scoped per‑cluster or shared across all clusters.

How does the gateway handle secret masking?

hoop.dev inspects API responses and redacts fields that match configured patterns, such as data sections in Secrets. The redacted value never leaves the gateway, ensuring downstream consumers only see placeholders.

For a deeper dive into configuration options, explore the learn section. When you’re ready to try it out, clone the repository and follow the quick‑start steps on GitHub: hoop.dev on GitHub.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts