How to Configure K3s Pod Security
You set up k3s pod security by adding admission rules to your cluster namespaces. These rules check every container before the node lets it start and run. Most engineering teams start with open rules so apps do not break right away. Still, wide open roles let a bad pod read host files or take over nodes. A good setup stops risky apps from starting while letting safe workloads run. How k3s pod security works in your cluster K3s uses the built-in Kubernetes admission controller to check pods wh
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 k3s pod security by adding admission rules to your cluster namespaces. These rules check every container before the node lets it start and run. Most engineering teams start with open rules so apps do not break right away. Still, wide open roles let a bad pod read host files or take over nodes. A good setup stops risky apps from starting while letting safe workloads run.
How k3s pod security works in your cluster
K3s uses the built-in Kubernetes admission controller to check pods when they start. You apply labels to a namespace to set the rule level you want. The system gives you three main rule levels to choose from. The privileged level has no limits and lets pods touch the host machine. The baseline level blocks known privilege climbs and keeps most apps safe by default. The restricted level adds strict rules for running as a non-root user. You can also choose to block bad pods, log a warning, or just audit them. When a developer sends a pod spec, the control plane checks it against these rules. If the pod asks for too much host power, the cluster stops it cold. You can also set cluster-wide defaults when the server starts up. This ensures new namespaces get safe rules even if an engineer forgets to add labels. Teams often start in audit mode to spot rule breaks before they enforce blocks.
What native admission rules solve and what they miss
Native admission rules do a great job of stopping bad setups before they run. They stop a container from mounting the host disk or sharing the host network. They also force teams to drop root rights inside the container image. Still, these checks only happen at the moment the cluster creates the pod. They do not watch what an engineer or an app does inside a running pod. Once a user logs in to a cluster role, admission rules step out of the way. If an engineer opens a shell into a running pod, admission rules do not check their commands. A user with exec rights can read secret files or run bad scripts inside the container. They can also query an internal database from that pod and pull raw customer data. Admission rules also cannot mask emails, phone numbers, or card numbers in command output. Native roles decide who can start a pod, not what commands run inside it later.
Managing live cluster access and runtime commands
To keep a cluster safe, teams must pair startup checks with live command controls. You should limit who can run interactive shells in your production namespaces. Many teams tie cluster roles to their main identity provider for better user tracking. Even then, broad role bindings often give engineers full access to every pod in a namespace. When an incident happens, people often share admin keys to fix the problem fast. Those shared keys leave no clear log of who ran which command on a pod. Teams need a way to check every command and query in flight during a session. You also want to approve risky actions one by one instead of granting day-long admin roles. By watching live traffic, you close the gap that static pod rules leave open.
K8s Pod Security Standards + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Govern kubectl and API calls in flight
Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev sits inline as an open-source proxy, a sidecar for your Kubernetes API, without replacing RBAC. On every production call from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails refuse banned methods, paths, or headers before they run or hold risky deletes for review. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.
Frequently asked questions
What happens to running pods when I tighten namespace rules?
Existing pods keep running when you change namespace labels to a stricter rule level. The admission controller only checks new pods or pods that restart after the change. You should run a dry check first to see which running workloads would fail later.
How do I handle system pods that need host access?
System agents like network plugins or storage drivers often need privileged host access to work. You should place these trusted workloads in their own dedicated namespace with privileged rules. Keep all user apps and business workloads in separate namespaces with baseline or restricted rules.
Do pod admission rules stop engineers from reading cluster secrets?
No, pod admission rules only check the container spec when the pod starts up. Role-based access controls decide which users or service accounts can read secret objects. If a user can open a shell in a pod, they can read its mounted secrets.
Related guides
In this post