How to Configure Semantic Kernel Kubernetes Prevent Delete
You set up semantic kernel kubernetes prevent delete by leaving the delete verb out of the agent role. Kubernetes roles only grant actions, so omitting delete blocks the AI agent from dropping resources. Teams often connect AI plugins to a cluster with a broad admin role during testing. When that broad role reaches production, a bad prompt can wipe out live workloads. How semantic kernel kubernetes prevent delete works in native RBAC Semantic Kernel uses plugins to run tasks against external
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 semantic kernel kubernetes prevent delete by leaving the delete verb out of the agent role. Kubernetes roles only grant actions, so omitting delete blocks the AI agent from dropping resources. Teams often connect AI plugins to a cluster with a broad admin role during testing. When that broad role reaches production, a bad prompt can wipe out live workloads.
How semantic kernel kubernetes prevent delete works in native RBAC
Semantic Kernel uses plugins to run tasks against external systems like a Kubernetes API server. Each plugin call uses a service account identity to talk to the cluster. Kubernetes role-based access control checks that identity before it runs any request.
In Kubernetes, a Role sets permissions inside one namespace. A ClusterRole sets permissions across the whole cluster. You attach these rules to the agent identity with a RoleBinding or a ClusterRoleBinding.
Permissions in Kubernetes are purely additive. There are no deny rules in the native role system. You cannot take a broad admin role and add a rule that blocks deletes. Instead, you must build a new role from scratch. You list only the safe verbs, such as get, list, watch, create, or patch. If you leave the delete verb off the list, the API server rejects delete requests.
You also have to watch how subresources work in the API. Kubernetes names subresources with a slash, like the log or exec endpoints on a pod. If a plugin has permission to use the exec subresource, it can run shell commands inside a container. Even without the delete verb on pods, the agent could still remove files inside the running app.
Why static cluster roles leave operational gaps for AI agents
Native roles solve the basic problem of who can call which API endpoint. They stop an agent from calling the delete API on a pod or deployment. They also help teams limit an agent to a single namespace.
Still, static roles only check the identity and the API verb at the door. They do not inspect the content of a command or the context of a task. An agent often needs update or patch verbs to do useful work. With those verbs, a confused model can scale a deployment down to zero replicas. The API server allows this because the request uses an update verb, not a delete verb. The result is the same as deleting the app.
Kubernetes RBAC + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static roles also apply the same rules to every run. You cannot require a human check for one risky change while letting safe reads pass through. When an agent reads pod logs or config maps, native roles do not filter the output. Sensitive data like emails, phone numbers, card numbers, or national IDs flow straight into the model prompt. Teams need a way to inspect each action in flight and rewrite sensitive fields in results.
Steps to lock down your agent cluster permissions
First, create a dedicated service account for your Semantic Kernel app. Never share a service account between human engineers and automated plugins. Next, audit every function in your cluster plugin to see what API calls it makes.
Group your plugin tasks into read actions and write actions. Write a Role in the target namespace that grants only get, list, and watch on needed resources. Bind that Role to the agent service account with a RoleBinding.
If the agent must change cluster state, add specific verbs like create or patch on single resource types. Keep the exec subresource out of the role so the agent cannot open a container shell. Test the plugin by asking the model to remove a test pod and confirm the API blocks it.
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 add a deny rule to an existing Kubernetes ClusterRole for my AI agent?
No, Kubernetes roles are purely additive and do not support deny rules. To block deletes, you must create a new Role or ClusterRole that leaves out the delete verb.
Does blocking the delete verb stop an AI agent from taking down a service?
Not always, because an agent with patch or update permissions can set replica counts to zero. It can also push a bad image tag or run shell commands if it has pod exec access.
Should I use a RoleBinding or a ClusterRoleBinding for a Semantic Kernel plugin?
Use a RoleBinding whenever possible so the agent can only touch resources inside one specific namespace. A ClusterRoleBinding gives access across all namespaces, which raises the risk if a prompt goes wrong.
Related guides
In this post