Kubernetes Self Hosting
You set up kubernetes self hosting by running your own control plane and worker nodes. You then turn on role-based rules on the API server to control user tasks. Most teams start by giving engineers broad cluster roles to get apps running fast. When roles are too broad, anyone with login credentials can change live workloads or read sensitive data. How kubernetes self hosting permissions work In a self-hosted cluster, the API server checks every request through role-based rules. These rules a
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 kubernetes self hosting by running your own control plane and worker nodes. You then turn on role-based rules on the API server to control user tasks. Most teams start by giving engineers broad cluster roles to get apps running fast. When roles are too broad, anyone with login credentials can change live workloads or read sensitive data.
How kubernetes self hosting permissions work
In a self-hosted cluster, the API server checks every request through role-based rules. These rules are only additive, which means there are no deny rules in the system. You start with zero access and add allowed verbs for specific resource types. A standard role sets these permissions inside one single namespace. A cluster role is not limited to one namespace. It can cover cluster-wide items like nodes, or resources across all namespaces.
To give those permissions to a user, you create a binding. A role binding grants permissions inside one namespace. It can point to a role in that namespace or to a shared cluster role. A cluster role binding grants access across the entire cluster at once. Teams often use a single cluster role and bind it to specific groups per namespace. This setup lets developers check their own apps without touching other teams.
The API server also uses subresources for actions like reading pod logs or running commands. In your rule list, you write these with a slash, such as pods and log or pods and exec. You must grant these subresources on top of basic pod view rights. If a role allows pod exec, the user can open a shell inside any container in that namespace.
What native cluster roles solve and what keeps the session active
Native roles and bindings solve the first problem of cluster security. They decide who can talk to the API server and which namespaces they can reach. You can separate production from staging and stop developers from deleting cluster nodes. You can also give read-only rights to auditors so they can check pod status safely.
Still, native rules stop at the API request level. Once the API server allows a pod exec request, it does not inspect the shell session. It cannot tell the difference between a safe check and a risky shell command. A developer who needs to check one file gets full shell rights inside that container. From there, they can read app memory, dump local variables, or query internal databases.
Self-Service Access Portals + Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
The same gap exists when users read logs or inspect data through port forwarding. Native roles do not rewrite sensitive fields like emails, phone numbers, or card numbers in the output. They also do not require a teammate to approve a risky command right before it runs. To close this gap, teams need controls that work on individual commands and responses in flight.
Planning day-two operations for your cluster
Running your own cluster takes more than just booting servers and setting up roles. You must also manage user credentials and rotate client certificates on a regular schedule. Static config files on engineer laptops create a big risk if a device gets lost. Teams should link their API server to a central identity provider instead of sharing static keys.
You also need clear logs of what happens inside your containers during a fix. The API server records that someone started an exec session on a pod. It does not record the exact shell commands they typed or the output that came back. Adding command-level tracking and field masking helps you keep production safe while engineers fix bugs.
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 runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.
With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. 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 write a deny rule in native Kubernetes RBAC?
No, native rules are only additive and do not support deny statements. To block an action, you must remove the role binding that grants that permission.
What is the difference between a role binding and a cluster role binding?
A role binding grants permissions inside one specific namespace only. A cluster role binding grants permissions across all namespaces and cluster-scoped resources.
Does the API server control what commands run inside a pod exec session?
No, the API server only checks if the user has permission to start the exec subresource. Once the shell opens, native RBAC does not filter or inspect the commands run inside the container.
Related guides
In this post