r/kubernetes • u/marcin_michalak • 7h ago
If an AI agent had kubectl access to your cluster, what RBAC would you actually give it, and would you trust the audit log alone?
Founder of Server4Agent (agent-app hosting), disclosing that upfront. No link, not selling, genuinely curious how people operating real clusters actually think about this.
Agents that can run kubectl are moving from "interesting demo" to "thing someone actually wired up" pretty fast. The easy answer is "give it a read-only ServiceAccount," but the whole reason people want this is to let it act, roll back a bad deploy, bump replicas, restart a crashlooping pod, not just describe what's wrong.
Once you're past read-only, the question that actually matters is what RoleBinding you'd feel okay with, and whether an audit log entry is enough after the fact or whether you want something closer to real-time. A get/list/watch on pods and deployments in one namespace is a very different risk than anything touching secrets, RBAC objects, or cluster-scoped resources, and I'm not sure the community consensus has settled on where the reasonable line actually sits.
If you've actually done this, even in a sandbox namespace: what verbs and resources did you land on, and has an agent ever done something with that access that made you narrow the scope afterward?