How to Configure MicroK8s Admission Controller

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a microk8s admission controller by editing the API server arguments file. After you save the new plugin list, you restart the local cluster daemon. Many teams enable a base set of plugins and stop there. They also grant broad cluster admin roles to help engineers move fast. When roles are too broad, users can bypass namespace limits and deploy risky pods. How a microk8s admission controller works Every request to your cluster passes through the API server first. First, the server c

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 a microk8s admission controller by editing the API server arguments file. After you save the new plugin list, you restart the local cluster daemon. Many teams enable a base set of plugins and stop there. They also grant broad cluster admin roles to help engineers move fast. When roles are too broad, users can bypass namespace limits and deploy risky pods.

How a microk8s admission controller works

Every request to your cluster passes through the API server first. First, the server checks who sent the request and verifies their key. Next, role rules decide if that user can run that type of action. If the role check passes, the admission phase starts right away.

This phase runs in two main steps before the cluster saves any change. Mutating plugins run first and can change the object being sent in. For example, a mutating rule can add default resource limits to a pod. Validating plugins run second and check if the final object meets your rules. If any plugin rejects the request, the server blocks the action right away.

In a local cluster, you control these plugins through the API server arguments. You list the active plugins by name in the server startup file. When the service restarts, the API server loads those plugins into memory. You can also register webhook servers to run custom checks outside the main process. The API server sends a webhook message to your custom app and waits. Your app replies with a simple allow or deny answer for that pod.

Why you should order mutating and validating phases

Order matters when your cluster processes a new resource request in flight. Mutating plugins must always finish before validating plugins start their checks. A mutating plugin might inject a sidecar container or add a missing label. If validation ran first, it would check an incomplete version of the pod. Running validation last ensures the final object matches every rule you set.

Teams also use webhooks to link external rule engines to this flow. The API server sends the object data to the webhook over the network. If the webhook server goes down, the API server follows a failure rule. You can set this rule to fail closed and block new pods. You can also set it to fail open so work keeps moving. Each choice trades strict safety for higher cluster uptime during an outage.

K8s Admission Controllers + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native cluster plugins solve and what they miss

Native plugins do a great job of checking static pod specs at deploy time. They stop pods that ask for too much memory or lack required labels. They can also block containers that try to run as the root user. This keeps bad YAML files out of your cluster before pods ever start.

Still, these plugins only inspect objects sent to the Kubernetes API. They decide which pods can start, not what users do inside running pods. Once an engineer opens a shell into a pod, admission plugins step aside. They do not inspect live commands or queries run inside an active session. They also cannot rewrite sensitive fields like emails or card numbers in output. If a user has broad role access, they can still run risky commands. Teams need runtime controls to check every command and query in flight.

Check Kubernetes API requests and responses on the wire

Kubernetes RBAC decides who may call the API server. RBAC does not check response payloads or split listing Secret names from reading Secret values when a role grants get access. With hoop.dev, you run an open-source proxy, a sidecar for your Kubernetes API, inline on the API connection. On every kubectl or API call an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

On each call, hoop.dev guardrails read the method, normalized path, and headers to refuse bad deletes or full Secret reads with a 403 error, or hold risky calls for approval. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs in memory. View the project on GitHub.

Frequently asked questions

Where do I enable plugins in a MicroK8s cluster?

You edit the API server arguments file stored in the cluster data folder. After you add the plugin names, you restart the cluster services to apply them.

What is the difference between mutating and validating plugins?

Mutating plugins can modify the incoming request to add defaults or labels. Validating plugins only inspect the final request and either allow or reject it.

Do admission plugins inspect commands inside a running pod?

No, admission checks only trigger when the API server creates or updates an object. Once a shell session starts, the plugin does not check commands run inside.

The query runs. The emails stay hidden.