How to Configure Haystack Kubernetes Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up haystack kubernetes prevent delete rules, restrict your service account roles. You must omit delete verbs from the Kubernetes RBAC rules assigned to Haystack. Many teams start by giving AI apps broad cluster roles for fast testing. When roles are too broad, a bad prompt or script can wipe out pods. It can also drop vital state data across your cluster. How haystack kubernetes prevent delete works in native RBAC Kubernetes RBAC uses roles to hold sets of rules for API actions. These

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.

To set up haystack kubernetes prevent delete rules, restrict your service account roles. You must omit delete verbs from the Kubernetes RBAC rules assigned to Haystack. Many teams start by giving AI apps broad cluster roles for fast testing. When roles are too broad, a bad prompt or script can wipe out pods. It can also drop vital state data across your cluster.

How haystack kubernetes prevent delete works in native RBAC

Kubernetes RBAC uses roles to hold sets of rules for API actions. These permissions are purely additive, which means there are no deny rules. To block deletions, you never grant the delete verb in the first place. You build a Role that lists only safe read and write actions. A Role sets permissions inside one single namespace for your Haystack pods. If Haystack needs cluster-wide reach, you use a ClusterRole instead. A ClusterRole covers cluster-scoped resources like nodes or resources across all namespaces. Next, you attach the role to the Haystack identity. A RoleBinding grants those permissions inside one specific namespace. A ClusterRoleBinding grants the permissions across the entire cluster. The API server checks these bindings through its built-in RBAC authorization mode. When Haystack sends a request, the API server checks the allowed verbs. If the delete verb is missing from the role, the server blocks it.

How subresources affect pod safety

Blocking top-level pod deletion is only half the battle for AI pipelines. Kubernetes APIs also expose subresources like pod logs and pod exec endpoints. In RBAC rules, the system writes a subresource with a slash. Even if Haystack cannot delete a pod, it might use the exec subresource. An agent with exec permissions can run shell commands inside a running container. Those internal commands can delete local files or wipe app state from within. Also, RBAC resource name limits on create actions only cover top-level resources. They do not restrict subresources at the individual resource name level. You must keep subresource rules tight so pipelines do not bypass delete blocks.

What native RBAC solves and what it misses

Native RBAC is great at deciding which service account can call an API. It stops direct delete calls against Kubernetes objects before they run. Still, static role setup leaves a big operational gap during live runs. RBAC decides who logs in and which broad API endpoints they can hit. It does not inspect what individual commands or queries do in flight. If a Haystack component needs exec rights to run tasks, RBAC steps aside. Once the session starts, native RBAC cannot stop a destructive shell command. Also, Haystack pipelines often read data that holds sensitive user details. Native cluster roles do not rewrite matched fields like emails or phone numbers. They also do not mask card numbers or national IDs in query results. Teams need controls that check individual actions and require approval for risky calls.

Kubernetes RBAC + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

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

Can I write an explicit deny rule in Kubernetes RBAC for Haystack?

No, Kubernetes RBAC permissions are purely additive and have no deny rules. To prevent delete actions, you must build a role that omits delete verbs. You also need to remove any broad bindings from the Haystack account.

Should I use a RoleBinding or a ClusterRoleBinding for Haystack?

Use a RoleBinding to keep Haystack permissions inside one specific namespace. Only use a ClusterRoleBinding if Haystack must manage resources across the whole cluster. Narrow namespace scopes reduce the risk of accidental deletions.

Why can Haystack still remove data when pod delete is blocked?

RBAC only checks API calls against Kubernetes objects like pods and services. If Haystack has pod exec access, it can run commands inside containers. It can also send delete queries to external databases using stored keys.

The query runs. The emails stay hidden.