How to Configure Dify Kubernetes Approval
To set up dify kubernetes approval, pause the agent workflow before it runs cluster tasks. Then require a human to review and approve the step before the call runs. Teams often link AI workflows to a cluster with a broad role to save time. When roles are too wide, an agent can change pods or read secrets across namespaces. How dify kubernetes approval works with cluster roles In a standard setup, the AI platform calls the cluster API using a service account. Kubernetes uses role-based rules t
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 dify kubernetes approval, pause the agent workflow before it runs cluster tasks. Then require a human to review and approve the step before the call runs. Teams often link AI workflows to a cluster with a broad role to save time. When roles are too wide, an agent can change pods or read secrets across namespaces.
How dify kubernetes approval works with cluster roles
In a standard setup, the AI platform calls the cluster API using a service account. Kubernetes uses role-based rules to check if that account can run the request. A Role sets rules inside one namespace, while a ClusterRole covers the whole cluster. You link these rules to the account with a RoleBinding or a ClusterRoleBinding.
Cluster permissions are additive, which means there are no deny rules in native roles. If you grant an agent access to a pod subresource, it gets full access. Before the AI workflow sends the API request, a human review node pauses the run. An operator checks the planned action in the chat or workflow view and clicks approve.
Once approved, the workflow resumes and sends the call using the stored cluster key. The API server checks the role binding and runs the task inside the target namespace. This setup stops the AI app from making changes without a human check first. Teams often scope the role to one namespace to limit the blast radius.
What native roles solve and what they miss
Native cluster roles and workflow pauses solve the first part of access control. They decide which service account can log in and which resource types it can touch. A RoleBinding keeps the AI agent inside one namespace when it reads pod logs. Workflow pauses also give engineers a chance to spot bad prompts before they run.
Still, a static role stays active at all times once you bind it. If a workflow step has permission to run pod exec calls, it can run anything. Native RBAC checks the resource name in the API URL, not the command inside. It cannot tell a safe status check apart from a command that drops data.
Approval Chains & Escalation + Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Also, the AI app holds the cluster key in its own store to make calls. Anyone who can edit the workflow can use that key without a new review. Pod logs or command outputs can also return sensitive data like emails or card numbers. Native roles do not rewrite matched fields in results before they reach the model.
Scoping subresources and human review steps
When you build an approval flow, split read tasks from write tasks in your roles. Give the read role access to basic pod status or log subresources in one namespace. Keep exec and delete actions in a separate path that always hits an approval step. This keeps routine checks fast while halting high-risk cluster tasks for a human look.
Reviewers need clear context when an approval prompt appears on their screen. Make sure the workflow passes the exact namespace, pod name, and command to the reviewer. If the prompt only shows a vague summary, a busy operator might approve a bad call. Even with good prompts, native setups trust the app to hold keys and follow rules.
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 Kubernetes RBAC block specific commands inside an exec call?
No, native RBAC only checks if the account can use the pod exec subresource. It does not inspect or block the shell commands that run inside the container.
How do Role and ClusterRole differ for AI agent workflows?
A Role grants permissions inside a single namespace, which helps isolate AI tasks. A ClusterRole can grant permissions across all namespaces or on cluster-wide resources like nodes.
Why is a workflow pause not enough for cluster safety?
A workflow pause relies on the AI app to hold keys and enforce the check. It does not expire cluster keys after the run or mask phone numbers in outputs.
Related guides
In this post