BCareerByteCodeByteLabs
Kubernetes & containers Intermediate Lab 4 of 4

Hands-On with Entra ID SSO for Kubernetes: OIDC and Group-Based RBAC on kubeadm

Federate a kubeadm cluster with Microsoft Entra ID so one login gives kubectl access, bind RBAC to group IDs, then measure what offboarding revokes and what it doesn’t.

By infantus godfrey
Problem statement

A person joins a project. They get access to the application through Entra ID, and that part is a single onboarding step. Then they ask for access to the Kubernetes cluster that runs on an on-prem server, and a second onboarding starts. Someone creates a client certificate, or hands over a shared admin kubeconfig, or creates a ServiceAccount token for them. That second path lives outside the identity system, so nobody reviews it, nobody expires it, and nobody remembers it when the person leaves.

The consequences are easy to predict. Leavers keep cluster access. The audit log shows a shared identity such as kubernetes-admin instead of a person. Laptops hold credentials that stay valid for a year or more.

This lab removes the second path. The Kubernetes API server trusts Entra ID as an OpenID Connect (OIDC) provider. Users sign in with their normal Entra account (and MFA), and Kubernetes RBAC is bound to Entra group object IDs. Adding someone to a group gives them cluster access, and removing them takes it away. No Kubernetes user is ever created.

To keep the cost low, the cluster is a single kubeadm node on one Linux server, and the identity side runs on the free tier of Microsoft Entra ID. If the server is a local machine, nothing is billed. If you use a cloud VM as a stand-in for the on-prem server, only that VM costs money (see Prerequisites).

Why we need this realtime usecase
  • One joiner, mover and leaver process. Entra ID already knows who is on the team. Cluster access should follow that record and not a separate spreadsheet of certificates.
  • Named identities in the audit trail. When a pod is deleted at 02:00, the API server audit log should show which person did it. A shared admin certificate cannot answer that question.
  • No long-lived credentials on laptops. The kubeadm admin kubeconfig holds a client certificate that lasts a year. OIDC tokens last about an hour.
  • Least privilege that people can read. A group called k8s-lab-developers bound to the edit role in one namespace is something a reviewer understands in ten seconds.
  • MFA comes with the identity provider. The cluster does not need its own MFA. Whatever Entra enforces at sign-in applies to kubectl too.
  • Evidence for reviews. Auditors in EU organisations ask who can reach production, how access is removed and where the logs are. This setup gives a direct answer to each.
When we need this realtime usecase
  • You run Kubernetes yourself (on-prem, edge, a private datacenter, a distribution that has no cloud-provider integration) and your company already uses Entra ID for its workforce.
  • More than two or three people need cluster access, and the shared admin kubeconfig has started to circulate.
  • An audit or security review flagged shared cluster-admin credentials or missing leaver controls.
  • You need to answer "who changed this" from the Kubernetes audit log.
  • You want one place to switch off a person's access during offboarding.
Prerequisites for the lab
ItemWhat you need
Entra ID tenantAn account that can create apps and grant admin consent (Application Administrator or Global Administrator). The free tier is enough, and no Azure subscription is needed. Leave security defaults on, because the lab relies on MFA registration.
ServerOne Ubuntu Server 24.04 LTS machine with 2 CPUs, 4 GiB RAM (8 GiB is comfortable), 20 GiB disk and a fixed IP. A physical box, a local VM or a cloud VM all work. You need sudo and SSH access from your laptop.
NetworkServer to internet: outbound HTTPS to login.microsoftonline.com, pkgs.k8s.io, registry.k8s.io, github.com and ghcr.io. Entra is the one that matters, and Step 6 tests it. Laptop to server: TCP 6443 and 22.
LaptopA bash-style terminal (Git Bash on Windows was tested) with ssh, scp, kubectl 1.36 or newer, grep, cut, tr, awk, base64 and date, plus krew and the oidc-login plugin from Step 12. No Python is needed.
Step by step implementationBundle

Unlock the full lab

The step by step build and conclusion are part of a ByteLabs bundle. Enrol once to unlock every gated section in it for 3 months.

Enrol in "Azure Operations Labs" · ₹767

Already bought this? Sign in to open it.

ConclusionBundle

Unlock the full lab

The step by step build and conclusion are part of a ByteLabs bundle. Enrol once to unlock every gated section in it for 3 months.

Enrol in "Azure Operations Labs" · ₹767

Already bought this? Sign in to open it.

All labs Write a usecase