How to Configure LlamaIndex Kubernetes Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up llamaindex kubernetes read only access by binding a restricted Kubernetes Role to the agent service account. This setup limits your AI workflow to viewing cluster objects without changing or deleting workloads. Many teams start by giving their agent broad cluster admin rights during early tests. When an agent holds broad rights, a bad prompt or tool call can delete pods or read secrets. Scoping the agent down to read-only rules is the first step toward safe cluster automation. How l

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up llamaindex kubernetes read only access by binding a restricted Kubernetes Role to the agent service account. This setup limits your AI workflow to viewing cluster objects without changing or deleting workloads. Many teams start by giving their agent broad cluster admin rights during early tests. When an agent holds broad rights, a bad prompt or tool call can delete pods or read secrets. Scoping the agent down to read-only rules is the first step toward safe cluster automation.

How llamaindex kubernetes read only access works in native RBAC

LlamaIndex connects language models to your external data and tools. The official LlamaIndex docs warn that running model-generated queries carries real security risks. Those docs advise teams to take care by using restricted roles, read-only targets, and sandboxing. That advice applies to databases and to Kubernetes clusters alike.

In Kubernetes, role-based access control regulates what an account can do on the API server. Permissions in Kubernetes RBAC are additive, meaning there are no deny rules. You start with zero rights and add allowed verbs like get, list, and watch. A Role sets permissions inside one single namespace. A ClusterRole sets permissions across all namespaces or for cluster-wide items like nodes.

To grant read-only access, an admin defines a Role or ClusterRole with read verbs only. Next, you link that role to the identity used by the LlamaIndex app. A RoleBinding grants those permissions inside one specific namespace. A ClusterRoleBinding grants the permissions across the entire cluster. If your agent needs to read pod logs, you must also grant access to the pods log subresource. Leaving out write verbs like create, update, patch, and delete stops the agent from altering cluster state.

What native RBAC solves and what it leaves open

Native Kubernetes RBAC solves the basic problem of who can call the API server. It stops a LlamaIndex agent from deleting deployments, scaling nodes, or launching new pods. It also keeps a namespace-bound agent from wandering into other namespaces on the same cluster. For basic safety, this native role setup is essential.

Still, static RBAC rules only check the resource type and the action verb at login time. They do not inspect the actual data returned inside a response payload. For example, pod logs, events, or config maps often hold raw user data. A read-only agent fetching pod logs can pull emails, phone numbers, card numbers, or national IDs into the model prompt. Static RBAC cannot rewrite those matched fields in results before the agent reads them.

Auditor Read-Only Access + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static roles also lack per-request human approval for sensitive read calls. If you allow reading secrets or config maps in a namespace, the agent can read all of them at any time. Also, Kubernetes audit logs record API calls. However, they do not tie those calls back to the specific user prompt in LlamaIndex. Teams need a way to inspect commands in flight, mask sensitive fields, and log every action with full context.

Scoping subresources and namespace boundaries

When you design your read-only roles, pay close attention to Kubernetes subresources. The API server treats subresources like pod logs and pod exec as distinct targets. A role that allows reading pods does not by default allow reading pod logs. You have to list the log subresource explicitly in your role rules.

You must also make sure you never include the exec subresource in a read-only role. Running exec opens a shell inside a container, which lets the agent change files or run scripts. Keep your bindings scoped to single namespaces with a RoleBinding whenever possible. Avoid ClusterRoleBindings unless the LlamaIndex tool truly needs to inspect nodes or cluster-wide state.

Govern kubectl and API calls in flight

Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.

Frequently asked questions

Can Kubernetes RBAC block specific resources using deny rules?

No, Kubernetes RBAC rules are strictly additive and do not support deny rules. To block an agent from reading a resource, you must leave that resource out of every Role and ClusterRole bound to its account.

Why should I use a RoleBinding instead of a ClusterRoleBinding for LlamaIndex?

A RoleBinding restricts the agent to a single namespace, reducing the blast radius if a prompt goes wrong. A ClusterRoleBinding gives the agent read rights across every namespace in the cluster at once.

Does read-only pod access let a LlamaIndex agent read container logs?

Not by itself, because Kubernetes treats pod logs as a separate API subresource. You must explicitly add the pods log subresource with get and list verbs to your RBAC role.

The query runs. The emails stay hidden.