How to Configure MicroK8s Pod Security

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up microk8s pod security by turning on built-in admission rules on namespaces. These rules check pod settings before the cluster starts any container. Teams often run local or edge clusters with open default settings at first. They give developers wide cluster roles to ship apps fast. Broad roles let users start root containers or mount the host disk. A single bad pod spec can then put the whole node at risk. How microk8s pod security works in practice The cluster uses a built-in admi

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 microk8s pod security by turning on built-in admission rules on namespaces. These rules check pod settings before the cluster starts any container. Teams often run local or edge clusters with open default settings at first. They give developers wide cluster roles to ship apps fast. Broad roles let users start root containers or mount the host disk. A single bad pod spec can then put the whole node at risk.

How microk8s pod security works in practice

The cluster uses a built-in admission controller to check every new pod request. You do not need to install third-party policy engines for basic rules. Instead, you add standard labels to each namespace in your cluster. These labels tell the API server which security level to use.

Kubernetes offers three main security levels for your workloads. The privileged level puts no limits on what a pod can do. It works best for system tools that must manage the node itself. The baseline level blocks known privilege climbs and host network shares. It lets most standard apps run with very few changes. The restricted level sets strict rules for high-risk apps. It forces containers to run as non-root users and drop extra Linux powers.

You can pick three ways to handle rule breaks in each namespace. The enforce mode stops bad pods from starting at all. The audit mode lets the pod run but writes a note in the log. The warn mode lets the pod run and shows a message to the user. Teams start with warn and audit modes on old apps. They read the logs, fix the pod specs, and then turn on enforce mode.

What native pod rules solve and what they miss

Native admission rules do a great job of blocking unsafe container setups. They stop pods from grabbing host ports or sharing the node process space. They also force teams to declare clean security contexts in their app files. This stops many common container breakouts before a pod ever starts running.

K8s Pod Security Standards + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, admission rules only check the pod spec at start time. They do not watch what engineers or scripts do inside a running pod. To fix bugs, developers still need cluster roles that allow interactive shell sessions. Once a user logs in to a namespace, native rules step aside.

A user with shell rights can run any command inside that container. They can read app secrets, dump local files, or query internal databases. Standard cluster roles decide who can connect to the API server. They cannot inspect individual commands or hide sensitive data like emails and card numbers. You also get very little detail in the logs about what happened inside the shell. Teams must pair startup rules with controls that manage live cluster sessions.

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

What happens to running pods when I add namespace rules?

Running pods keep working even if they break the new namespace rules. The admission controller only checks new pods when they start or update. You should test new rules in warn mode before you restart your apps.

Why did my deployment fail to create pods without an error?

When a deployment makes pods, the replica controller sends the start request. If enforce mode blocks the pod, the error hides inside the replica status. You can turn on warn mode to see clear alerts during deployment updates.

Can I exempt system tools from strict namespace rules?

Yes, you can put system tools in their own namespace with privileged labels. You can also set the API server config to skip specific service accounts. Keeping system pods in separate namespaces is the cleanest way to manage them.

The query runs. The emails stay hidden.