DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › AI agents

Kubernetes Read-Only for AI Agents: Why Prompts Cannot Prevent Deletion

By Freedom251 Team · · 9 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

No. Telling an AI agent “please don’t delete anything” is not a Kubernetes security control. The API server authorizes every request using the caller’s identity, namespace or cluster scope, resource and subresource, and verb. If that identity can issue delete, patch, update, create, or an indirect privilege such as workload creation, the request can be allowed regardless of what a prompt says.

Reliable read-only access requires an intentionally limited ServiceAccount, an explicit RBAC Role and RoleBinding, careful treatment of subresources such as nodes/proxy, and checks for indirect escalation. Admission policies, Pod Security, short-lived credentials, and audit reviews add defense in depth, but RBAC remains the enforceable identity-and-verb boundary.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What actually makes Kubernetes access read-only?

Kubernetes read-only access is a set of authorization rules, not a behavioral promise. The API server evaluates each request against the authenticated identity and the exact combination of scope, resource, subresource, and verb.

RBAC is additive

A Role or ClusterRole grants permissions; Kubernetes RBAC has no deny rules. If any bound role grants a capability, another role cannot subtract it. A ServiceAccount with one narrow RoleBinding can therefore be safer than an account that accumulates several apparently harmless bindings.

Popular on Amazon
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Use explicit verbs such as get, list, and watch only where the agent needs them. Do not use wildcard resources or verbs as a shortcut: a wildcard also covers subresources and future API additions, so an upgrade can silently expand what the identity can do.

Every dimension matters

Dimension Example question Why it changes risk
Identity Which ServiceAccount is making the call? All of its RoleBindings and ClusterRoleBindings combine additively.
Scope One namespace or the whole cluster? A namespaced Role cannot grant access outside its namespace; a ClusterRoleBinding can.
Resource pods, secrets, or deployments? Different resources expose different data or control paths.
Subresource pods/log or nodes/proxy? Subresources can have consequences unlike the parent object.
Verb get, create, patch, or delete? Write and delegation verbs can alter workloads or authorization.

How do I create a narrowly read-only identity for an AI agent?

Start with a dedicated ServiceAccount and bind it in the smallest namespace scope that satisfies the agent’s job. Enumerate resources and subresources instead of granting a broad built-in role.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a ServiceAccount. Keep it separate from application accounts so its permissions and audit trail are easy to review.
  2. Create a namespace Role. List only the resources the agent must inspect and grant only get, list, and watch. Add pods/log only when log retrieval is an actual requirement.
  3. Bind the Role to that ServiceAccount. Use a RoleBinding in the same namespace. Avoid a ClusterRoleBinding unless cluster-wide visibility is unavoidable.
  4. Test the effective policy. Run kubectl auth can-i as the ServiceAccount for every resource and subresource, including negative tests for writes and sensitive reads.
  5. Review after changes and upgrades. Role aggregation, new subresources, and modified built-in roles can change the effective result.

Example namespace-scoped policy

apiVersion: v1
kind: ServiceAccount
metadata:
  name: ai-observer
  namespace: operations
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: ai-observer-read
  namespace: operations
rules:
- apiGroups: [""]
  resources: ["pods", "services", "configmaps", "events"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
  resources: ["deployments", "replicasets", "statefulsets", "daemonsets"]
  verbs: ["get", "list", "watch"]
- apiGroups: [""]
  resources: ["pods/log"]
  verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: ai-observer-read
  namespace: operations
subjects:
- kind: ServiceAccount
  name: ai-observer
  namespace: operations
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: ai-observer-read

This example intentionally omits Secrets, workload creation, RBAC objects, token requests, and node access. Adapt the resource list to the agent’s task rather than copying it unchanged into production.

Is Kubernetes’ built-in view role safe for an AI agent?

The built-in view ClusterRole is a useful starting point for ordinary namespace inspection, but it is not a universal safe profile. It permits read-only access to most objects in a namespace while intentionally excluding Secrets.

Why Secrets are excluded

Secret contents can contain passwords, API keys, certificates, and tokens. A seemingly read-only agent can disclose those values if it can retrieve them. Treat get, list, and watch on Secrets as sensitive: list and watch responses can expose Secret data just as surely as an individual get.

Also popular on Amazon
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Why “view” still needs an inventory

Built-in roles evolve with Kubernetes. They also do not answer whether the agent needs logs, custom resources, or cluster-wide information. Check the actual rules bound to the identity and test each subresource rather than assuming the role name describes every reachable path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can a get permission delete or control anything?

A normal get on a normal object does not grant deletion, but “read” is not synonymous with harmless. Some subresources expose privileged operations even when the verb is only get.

The nodes/proxy exception

Kubernetes RBAC guidance specifically warns that get on nodes/proxy reaches privileged kubelet APIs. Depending on the request path, that access can retrieve container logs or execute and attach to pod processes outside the ordinary Kubernetes API permission model. Do not include nodes/proxy in a read-only role unless the operational need and the resulting node-level trust are explicitly accepted.

Other subresources require separate review

Review pods/log, pods/exec, pods/attach, serviceaccounts/token, and status or scale endpoints separately. A rule for a parent resource does not tell you what every subresource does, and a wildcard can unintentionally grant all of them.

Why is workload creation an indirect privilege path?

Allowing an agent to create Pods or workload objects is not compatible with a simple read-only threat model. Kubernetes warns that workload creation implicitly grants access to many resources in the namespace because a Pod specification can request them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Also popular on Amazon
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

What a created Pod can reach

  • Mount another workload’s Secret, ConfigMap, or persistent volume.
  • Select a more privileged ServiceAccount and receive its credentials.
  • Use a security context, host mount, or host namespace setting that reaches node resources.
  • Expose data through a Service or communicate with systems protected only by namespace assumptions.

Controllers make the path less obvious

You do not need direct pods/create permission for the risk to exist. A Deployment, Job, CronJob, or custom resource may create Pods on the agent’s behalf. Evaluate every object the agent can create or modify and inspect the controller that reconciles it. A role that can edit a harmless-looking custom resource may effectively control a privileged workload.

Which permissions should a read-only agent never receive by default?

Start by denying the capability through omission: do not bind roles that contain these permissions unless a documented task requires them and compensating controls are in place.

Permission or area Risk Safer default
create, update, patch, delete Directly changes or removes objects. Omit; grant only to a separate execution identity if needed.
Workload creation or modification Can mount Secrets, choose ServiceAccounts, or reach nodes. Keep outside the observer identity.
bind or escalate on RBAC roles Can delegate or enlarge authorization. Never include in a read profile.
impersonate users, groups, or ServiceAccounts Allows requests to run as another identity. Omit; test impersonation explicitly.
serviceaccounts/token Can mint a token for a ServiceAccount. Restrict to a tightly controlled issuer.
Certificate-signing or CSR approval Can create credentials trusted by the cluster. Separate from observation.
Mutating or validating webhook configuration Can alter or bypass policy decisions for future requests. Administrators only.
Namespace label changes May weaken Pod Security or NetworkPolicy assumptions. Do not delegate to an agent that only reads.
nodes/proxy Reaches privileged kubelet APIs, including process execution paths. Exclude unless separately justified.

Can admission control replace RBAC for an AI agent?

No. Authorization runs before admission and answers whether the identity may attempt the operation. Admission controllers can validate or mutate write-like requests such as create, update, patch, and delete, but read requests (get, list, and watch) bypass admission.

Use Pod Security admission and validating policies to constrain any workload the agent can influence: forbid host access, restrict ServiceAccount selection, require safe security contexts, and enforce namespace-specific rules. These controls complement RBAC; they do not make a broadly authorized identity read-only, and they cannot prevent sensitive data returned by an allowed read.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How should ServiceAccount credentials be hardened?

Bind only the minimum permissions required to the dedicated account. If the agent uses an external read path and does not need Kubernetes credentials inside a Pod, set automountServiceAccountToken: false on that Pod or ServiceAccount.

Also popular on Amazon
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

In Kubernetes v1.22 and later, projected tokens obtained through the TokenRequest mechanism are short-lived and rotate automatically. Prefer that model over distributing long-lived static token Secrets. Token rotation limits exposure time, but it does not reduce the permissions granted to the identity, so the RBAC review remains essential.

Example Pod setting

apiVersion: v1
kind: Pod
metadata:
  name: agent-gateway
  namespace: operations
spec:
  serviceAccountName: ai-observer
  automountServiceAccountToken: false
  containers:
  - name: gateway
    image: example/agent-gateway:stable

Only set automount to false when the process truly does not need in-cluster API credentials. If it does need them, use a projected, short-lived token and keep the account’s permissions narrow.

How do I verify what an AI agent can really do?

Check effective authorization as the exact ServiceAccount identity, not as your administrator account. Include positive checks for required reads and negative checks for dangerous verbs and subresources.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
kubectl auth can-i get pods -n operations --as=system:serviceaccount:operations:ai-observer
kubectl auth can-i list deployments.apps -n operations --as=system:serviceaccount:operations:ai-observer
kubectl auth can-i get pods/log -n operations --as=system:serviceaccount:operations:ai-observer
kubectl auth can-i get secrets -n operations --as=system:serviceaccount:operations:ai-observer
kubectl auth can-i create pods -n operations --as=system:serviceaccount:operations:ai-observer
kubectl auth can-i get nodes/proxy --as=system:serviceaccount:operations:ai-observer
kubectl auth can-i impersonate serviceaccounts --as=system:serviceaccount:operations:ai-observer

The expected result is yes only for documented reads and no for Secrets, writes, impersonation, workload creation, and node proxy access unless a specific exception has been approved. Also inspect the account’s role bindings and audit logs to catch calls made through controllers or unexpected clients.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What is a practical operating checklist?

  • Create one ServiceAccount per agent or trust boundary; do not reuse a human administrator account.
  • Prefer a namespace-scoped RoleBinding over cluster-wide visibility.
  • List resources and subresources explicitly and avoid * wildcards.
  • Grant only the required get, list, and watch verbs.
  • Exclude Secrets by default and scrutinize list and watch responses.
  • Keep workload creation, RBAC delegation, impersonation, token minting, CSR approval, webhook configuration, namespace-label changes, and nodes/proxy out of the profile.
  • Disable token automount for Pods that use an external read path.
  • Apply Pod Security and admission policies to any workload the agent can influence.
  • Run kubectl auth can-i checks with the agent identity, including subresources and impersonation.
  • Review audit events and role bindings periodically.
  • Repeat the review after Kubernetes upgrades because built-in roles and subresources evolve.

What should I do when the agent still changes the cluster?

First identify the exact request and identity in the audit log. A common cause is that the agent is using a different ServiceAccount, a second RoleBinding grants a write verb, or a controller is acting on an object the agent was allowed to create.

Also popular on Amazon
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  1. Run kubectl auth can-i --list -n <namespace> --as=system:serviceaccount:<namespace>:<name> and inspect every granted rule.
  2. Check for ClusterRoleBindings, aggregated roles, and bindings added by automation.
  3. Test the parent resource and each subresource separately; do not infer pods/log or nodes/proxy behavior from pods.
  4. Remove workload or delegation permissions, then retest with a fresh token.
  5. If the operation is a read, check whether the path is exposing credentials or kubelet functionality rather than changing an object directly.

When the required task is inherently mutating, place it behind a separate, narrowly scoped execution service with approval and policy checks. Do not weaken the observer identity to make one automation path convenient.

Frequently Asked Questions

Can an AI agent use kubectl get without any Kubernetes risk?

It can still expose sensitive configuration, credentials, or operational data through allowed responses. Risk depends on the resources and subresources, not on the presence of the word get in a command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I give an agent the cluster-wide view role for monitoring?

Only when cluster-wide visibility is a documented requirement. A namespace-by-namespace design reduces the blast radius and makes it easier to exclude sensitive namespaces and resources.

How often should read-only Kubernetes permissions be reviewed?

Review them whenever the agent, its controllers, or the cluster’s API surface changes, and schedule periodic checks even when nothing appears to have changed. Re-run effective-permission tests after Kubernetes upgrades because built-in roles and subresources can evolve.

What if the agent must restart a failed workload?

Treat that as a separate mutating capability rather than expanding the read-only account. Use a narrowly scoped workflow that permits only the required restart action, with admission policy, audit logging, and human or automated approval appropriate to the environment.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

AI agentscloud securityDevOpsKubernetesRBACServiceAccounts

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.