How to Configure Cline Kubernetes Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a cline kubernetes prevent delete workflow by binding restricted cluster roles. You also require manual approval before the coding agent runs terminal commands. Many engineering teams connect coding agents directly to their local cluster credentials. When an agent shares a developer's broad admin role, one bad prompt can wipe out production pods. Teams often start by limiting what the agent's identity can do inside the cluster. How to set up cline kubernetes prevent delete with RBAC

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 a cline kubernetes prevent delete workflow by binding restricted cluster roles. You also require manual approval before the coding agent runs terminal commands. Many engineering teams connect coding agents directly to their local cluster credentials. When an agent shares a developer's broad admin role, one bad prompt can wipe out production pods. Teams often start by limiting what the agent's identity can do inside the cluster.

How to set up cline kubernetes prevent delete with RBAC

Cline is an AI coding agent that runs terminal commands and reaches external tools. When the agent runs cluster commands on your machine, it uses your local kubeconfig context. If that context has full admin rights, the agent inherits those same broad permissions. To stop destructive actions at the cluster level, you must create a separate identity for the agent.

Kubernetes role-based access control lets you define what an identity can do. In Kubernetes, permissions are purely additive, which means there are no deny rules. You cannot take an admin role and attach a rule that blocks delete actions. Instead, you must build a new Role or ClusterRole from scratch. A Role sets permissions within a single namespace. A ClusterRole covers cluster-wide resources or spans across all namespaces.

To prevent deletions, you grant only read verbs or safe write verbs in that role. You list allowed actions like reading pods, checking logs, or creating new deployments. You leave out the delete and deletecollection verbs from the rule list. Next, you link this role to a dedicated service account using a RoleBinding or ClusterRoleBinding. Finally, you point the coding agent's shell session to use that restricted service account.

How agent command approvals work alongside cluster roles

Besides cluster roles, teams also use the coding agent's own approval settings. Cline asks the user for permission before it runs a terminal command or tool call. Developers can review the proposed command in the editor and reject anything that looks risky. This adds a human check before a destructive command ever leaves the workstation.

Still, human review alone fails when teams turn on auto-approve modes to move faster. Even when a developer reads every prompt, complex shell scripts can hide destructive actions inside long pipes. Combining local prompt checks with strict Kubernetes RBAC gives you two layers of defense. The editor asks before running the command, and the API server rejects unauthorized verbs.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native RBAC solves and what it leaves open

Native Kubernetes RBAC is great at enforcing static rules for known identities. If an agent uses a read-only role, the API server blocks every delete request right away. This works well when the agent only needs to inspect cluster state or read pod logs.

The gap appears when an agent needs write permissions to fix bugs or deploy apps. Because Kubernetes RBAC has no deny rules, maintaining custom roles for every task becomes hard. Developers often switch back to their own admin credentials just to unblock a task. Once the agent runs under a shared developer identity, static RBAC cannot tell them apart.

Native RBAC also checks only who logs in and which API resource they hit. It does not inspect the contents of a command inside a pod exec session. For example, if a role allows the pods/exec subresource, the agent can open a shell inside a container. From there, the agent can delete files or drop database tables without triggering a Kubernetes delete verb. Static roles also cannot mask sensitive data like emails, phone numbers, or card numbers in pod logs. When an agent reads logs or config maps, raw secrets and personal data flow straight into the model context.

Add request guardrails and response masking beside Kubernetes

Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev sits inline beside the API server as a sidecar for your Kubernetes API. For every production API call an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review alongside RBAC.

With hoop.dev Kubernetes controls, guardrails allow listing Secret names while refusing reads of Secret data before execution, and data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.

Frequently asked questions

Can I add a deny rule in Kubernetes RBAC to block delete commands?

No, Kubernetes RBAC permissions are purely additive and do not support deny rules. To block deletions, you must create a new Role that includes only safe verbs like get, list, and watch.

Why can Cline still delete data if I remove the Kubernetes delete verb?

Removing the delete verb only stops the agent from deleting Kubernetes API objects like pods or services. If the role still allows pod exec access, the agent can run shell commands inside a container and delete app data.

Should Cline use the same kubeconfig file as the developer?

Sharing a developer's default kubeconfig is risky because it gives the agent the developer's full cluster rights. You should point the agent's terminal session to a dedicated kubeconfig tied to a restricted service account.

The query runs. The emails stay hidden.