How to Configure MicroK8s Temporary Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up microk8s temporary access by making short-lived service tokens and role bindings. These tokens let an engineer log in to the cluster for a fixed time. Many teams start by sharing one static admin file across the whole group. That file stays valid forever and gives full control over every cluster resource. When a role is too broad, one bad command can delete live workloads. How to set up microk8s temporary access MicroK8s uses standard Kubernetes role rules to check who can run comm

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 temporary access by making short-lived service tokens and role bindings. These tokens let an engineer log in to the cluster for a fixed time. Many teams start by sharing one static admin file across the whole group. That file stays valid forever and gives full control over every cluster resource. When a role is too broad, one bad command can delete live workloads.

How to set up microk8s temporary access

MicroK8s uses standard Kubernetes role rules to check who can run commands. To grant time-bound entry, you first create a dedicated service account in a namespace. Next, you define a role that lists the exact actions the user needs. You then link that role to the service account with a role binding.

Modern Kubernetes clusters let you request a token that expires after a set time. Instead of saving a static secret, the cluster signs a token with a time limit. You send this short-lived token to the engineer who needs to fix an issue. When the timer runs out, the cluster rejects any new commands from that token.

You can also link the cluster to an external login tool using OpenID Connect. In that setup, the identity tool issues a short token after the user logs in. The cluster checks the token signature and reads the group claims on each request. Both methods stop engineers from keeping permanent admin keys on their laptops.

Why role revocation needs active cleanup

Short tokens solve the problem of lost keys, but role bindings still linger. If a token expires while the role binding stays active, the account still exists. An admin must delete the role binding after the work window ends. Without cleanup, old accounts pile up across namespaces and make audits hard to read.

Teams often run scripts or timers to remove old role bindings every hour. If a script fails, a temporary account can keep its permissions for days. You should check active bindings often to make sure temporary roles do not stick around. Clear naming rules for temporary accounts help teams spot stale access fast.

Customer Support Access to Production + Temporary Project-Based Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native cluster roles leave open

Native cluster roles control who can log in and which resources they can touch. Once a user gets permission to open a pod shell, role checks stop. The cluster cannot inspect the shell commands the engineer runs inside that container. A user with read rights on secrets can also copy raw keys and card numbers.

Native audit logs record the API call that opened the pod session. Those logs do not show the commands run inside the shell or the output returned. If a pod holds sensitive emails or phone numbers, the user sees the raw text. Native roles decide who gets in, not what happens inside an active session.

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

Can I revoke a short-lived token before it expires?

Bound tokens stay valid until their timer runs out unless you delete the service account. Deleting the service account or its role binding blocks the user right away. This step stops any further API calls from that token across the cluster.

How do I limit temporary access to one namespace?

Use a standard Role and RoleBinding instead of a ClusterRoleBinding when you set permissions. A standard RoleBinding applies only to the single namespace where you create it. The user will not have rights to read or change pods in other namespaces.

Why should I avoid sharing the default admin config file?

The default config file holds client certificates or static tokens with full cluster control. You cannot set a timer on that file without breaking access for everyone else. Giving each engineer a short-lived token keeps audit logs tied to real people.

The query runs. The emails stay hidden.