How to Configure Haystack Kubernetes Permissions
You set up haystack kubernetes permissions by pairing a service account with a scoped role. Then you bind that role to the single namespace where your AI app runs. Most teams start by giving their AI pods broad cluster rights to move fast. Broad roles let any compromised pod read secrets or change workloads across the whole cluster. A tight setup limits what the app and your engineers can touch. How to set up haystack kubernetes permissions with native RBAC Kubernetes role-based access contro
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 haystack kubernetes permissions by pairing a service account with a scoped role. Then you bind that role to the single namespace where your AI app runs. Most teams start by giving their AI pods broad cluster rights to move fast. Broad roles let any compromised pod read secrets or change workloads across the whole cluster. A tight setup limits what the app and your engineers can touch.
How to set up haystack kubernetes permissions with native RBAC
Kubernetes role-based access control uses four main objects to manage permissions. These objects are the Role, ClusterRole, RoleBinding, and ClusterRoleBinding. In this system, all rules are additive. There are no deny rules in native Kubernetes access control. You start with zero rights and add only the verbs and resources you need.
A Role sets permissions inside one specific namespace. A ClusterRole is not tied to a single namespace. It can cover cluster-wide items like nodes, or namespaced items across all namespaces. For an AI pipeline, you should create a standard Role in the app namespace. This keeps your Haystack pods from reaching into other team spaces.
Next, you connect the Role to your workload identity. A RoleBinding grants the rules inside one namespace to a user or service account. A RoleBinding can point to a Role in that same namespace. It can also point to a shared ClusterRole while keeping the grant inside one namespace. Avoid using a ClusterRoleBinding for app pods because it grants rights across the entire cluster.
You also need to plan for subresources like pod logs and command execution. Kubernetes names resources based on how they appear in the API path. Subresources use a slash format to separate the main resource from the action. For example, reading pod logs or running commands inside a pod requires specific subresource rules. If you restrict access by specific resource names, know that create rules work differently. Name limits on create actions apply only to top-level resources, not to subresources.
Why native roles are only half the security story
Native roles and bindings do a great job of controlling the front door. They decide which service account or engineer can call the cluster API. They also stop a pod in one namespace from reading resources in another namespace.
Kubernetes RBAC + AI Agent Permissions: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, native access rules stop working once a session starts. If an engineer gets pod exec rights to debug a Haystack worker, the cluster checks one thing. It checks if the user has permission to open that exec stream. Once the shell opens, native RBAC cannot see what commands the engineer runs inside the container. It also cannot see what data the AI pipeline pulls from connected databases during that run.
The same gap applies to sensitive data inside your AI workflows. A Haystack pipeline often processes customer text, emails, phone numbers, card numbers, or national IDs. Native cluster roles only decide if a pod can start or read a secret volume. They do not inspect database queries, filter live command output, or rewrite matched fields in results. Teams need a way to govern actions in flight, not just initial logins.
Check Kubernetes API requests and responses on the wire
Kubernetes RBAC decides who may call the API server. RBAC does not check response payloads or split listing Secret names from reading Secret values when a role grants get access. With hoop.dev, you run an open-source HTTP proxy, a sidecar for your Kubernetes API. The kubectl client changes only the server address it talks to while RBAC stays in place.
On each call, hoop.dev guardrails read the method, normalized path, and headers to refuse bad deletes or full Secret reads with a 403 error. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs. Every request and verdict is logged without storing bearer tokens. View the project on GitHub.
Frequently asked questions
Should I use a Role or a ClusterRole for Haystack pods?
Use a standard Role paired with a RoleBinding in the namespace where Haystack runs. This keeps the pod permissions inside that single namespace. Only use a ClusterRole if the workload must read cluster-wide objects like nodes.
Can I write a rule to deny pod exec access for specific users?
No, because permissions in Kubernetes are purely additive and have no deny rules. To block pod exec access, you must omit the exec subresource from the user's Role. Grant that subresource only in a separate Role for approved operators.
How do subresource rules work for viewing Haystack pod logs?
In Kubernetes RBAC, pod logs are a subresource written with a slash after the pods resource. You must grant get and list verbs on both the pod resource and its log subresource. This lets engineers read logs without giving them rights to change the pod.
Related guides
In this post