Skip to main content
Welcome to this lesson on authenticating access to a Kubernetes cluster. A cluster consists of multiple physical or virtual nodes and several internal components working together to run your workloads. It’s crucial to secure management access by verifying identities for anyone or anything interacting with the API server. Actors interacting with the cluster: Kubernetes relies on external identity sources (files, certificates, identity services like LDAP or OIDC) for human user authentication, while it internally manages service accounts. All requests pass through the kube-apiserver, which authenticates before authorizing. Supported authentication methods:
The image illustrates authentication mechanisms for "kube-apiserver," including static password files, static token files, certificates, and identity services.

1. Static Password File

The simplest approach uses a CSV file with one line per user:

Configuring the API Server

Choose your setup:
  1. Systemd unit (/etc/systemd/system/kube-apiserver.service):
  2. kubeadm (edit /etc/kubernetes/manifests/kube-apiserver.yaml under spec.containers.command):
After saving changes, the API server will restart automatically (kubeadm) or after reloading your systemd unit.

Testing Password Authentication


2. Static Token File

Bearer tokens offer another static method. Create a CSV containing tokens:
Add to your API server flags:

Testing Token Authentication


Storing usernames, passwords, or tokens in plain text is not recommended for production. Use secure vaults or external identity providers for sensitive environments.
The image contains a note with three bullet points about authentication mechanisms, volume mounting in kubeadm setup, and setting up role-based authorization for new users.

Security Considerations

  • For kubeadm clusters, mount your credential files into the API server Pod via a volume.
  • Protect files with restrictive filesystem permissions (chmod 600).
  • After authenticating users, configure Role-Based Access Control (RBAC) to grant least-privilege permissions.

Next, we’ll explore certificate-based authentication and how Kubernetes components use TLS certificates to secure communication.

Watch Video