How to Configure MicroK8s OIDC
To set up microk8s oidc, you link your cluster API server to your identity provider. You then map identity provider groups to Kubernetes roles so engineers can log in. Most teams start by sharing one admin config file across the whole group. That shared file gives every user full control over all cluster workloads and secrets. When teams grow, they switch to token logins to track who enters the cluster. Even with individual logins, broad cluster roles often give users too much power. How micro
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.
To set up microk8s oidc, you link your cluster API server to your identity provider. You then map identity provider groups to Kubernetes roles so engineers can log in. Most teams start by sharing one admin config file across the whole group. That shared file gives every user full control over all cluster workloads and secrets. When teams grow, they switch to token logins to track who enters the cluster. Even with individual logins, broad cluster roles often give users too much power.
How microk8s oidc works in your cluster
MicroK8s runs a lightweight Kubernetes setup on a single machine or small node group. Out of the box, it uses a static token file for local admin access. Static tokens do not expire on their own and are hard to rotate. Adding OpenID Connect lets your team use existing company accounts to log in.
First, you register a new app inside your identity provider. The provider gives you an issuer URL and a unique client identifier. Next, you update the cluster API server settings on your host nodes. You tell the API server to trust tokens signed by that issuer URL. You also tell it which token fields hold the user name and group list. After you save those settings, you restart the cluster services to apply the change.
On the client side, each engineer runs a login helper on their laptop. The helper opens a browser window so the user can sign in. Once the user signs in, the identity provider sends back a short-lived ID token. The local Kubernetes client attaches that token to every request sent to the cluster. The API server checks the token signature and reads the user group claims.
Mapping identity groups to Kubernetes roles
Checking a token only proves who the user is during login. Your cluster still needs rules to decide what that person can do. Kubernetes uses role-based access control to manage these actions inside the cluster.
You create roles that list allowed actions on pods, services, or config maps. Then you create role bindings that link your identity provider groups to those roles. When a developer logs in, their group claim matches the binding. They get the exact permissions tied to that group right away. If someone leaves the team, you remove them from the identity provider. Once their current token expires, they can no longer reach the cluster API.
End-to-End Encryption + K8s OIDC Authentication: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Teams often add a name prefix to user and group claims in the cluster. This simple prefix stops external group names from clashing with built-in system accounts. It also makes audit logs easier to read when you check past events.
What native cluster login leaves open
Setting up microk8s oidc fixes the problem of shared admin keys. It ensures every person uses their own company account to reach the cluster. Still, native identity checks only happen at the front door of the API server. They decide who can enter, not what happens inside an active shell session.
Many engineers need to open a shell inside a running pod to fix bugs. Once Kubernetes allows the shell request, role checks step out of the way. The cluster cannot inspect the commands the user types inside that container. If the pod holds database keys, the user can read raw production tables. Native roles also cannot rewrite sensitive fields like emails, phone numbers, or card numbers. Teams need deeper controls to approve risky commands and protect live data 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
Why do my token logins fail after I update the API server?
Login failures usually happen when the issuer URL or client ID does not match. Check that your cluster node can reach the identity provider over the network. Also make sure you restarted the cluster services after saving the new settings.
How do I take away cluster access when an engineer leaves?
Remove the user from your identity provider or take them out of the group. They will lose access as soon as their current ID token expires. Keep token lifetimes short so access ends fast after an account change.
Can I use group claims to limit access to one namespace?
Yes, you can bind an identity provider group to a namespace role. That binding lets the group manage workloads inside that single namespace only. They will not be able to read or change resources in other namespaces.
Related guides
In this post