Cloud Native 17 min read

Mastering Kubernetes Authentication, Authorization, and Admission Control

This guide explains Kubernetes' security pipeline—authentication, authorization, and admission control—detailing token and SSL authentication, service accounts, RBAC, ABAC, Node and Webhook authorizers, and the essential admission plugins, with practical kubectl commands and configuration examples.

Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Mastering Kubernetes Authentication, Authorization, and Admission Control

Authentication

Kubernetes secures every request to the API server through a three‑step process: authentication, authorization, and admission control. The API server is the sole entry point for all cluster operations.

Token authentication

Clients present a bearer token in the HTTP Authorization header. The token is generated from a secret stored in the cluster and is used by kubectl to prove the identity of the caller.

SSL (certificate) authentication

Both the API server and the client present X.509 certificates signed by a trusted CA. Mutual TLS ensures that the server authenticates the client and vice‑versa, providing encrypted communication.

Service Accounts

Service accounts are Kubernetes resources designed for pod‑to‑API‑server communication. Unlike user accounts, they are namespace‑scoped and automatically mounted as a secret containing a token.

When a pod is created without an explicit serviceAccountName, the default service account of its namespace is assigned.

kubectl create serviceaccount test
kubectl get serviceaccount
kubectl describe serviceaccount test

The generated secret (e.g., test-token-xxxx) holds the token that pods use to authenticate to the API server.

Authorization

After authentication, Kubernetes determines whether the request is allowed. Several authorizers can be enabled; a request is permitted if any authorizer grants access.

Node Authorization

Restricts kubelet access to node‑related resources. Enabled with --authorization-mode=Node,RBAC and the NodeRestriction admission plugin.

ABAC (Attribute‑Based Access Control)

Uses a JSON policy file to define permissions. The API server is started with

--authorization-mode=ABAC --authorization-policy-file=policy.json

. Example policy:

{
  "apiVersion": "abac.authorization.kubernetes.io/v1beta1",
  "kind": "Policy",
  "spec": {
    "user": "alice",
    "namespace": "*",
    "resource": "*",
    "apiGroup": "*"
  }
}

RBAC (Role‑Based Access Control)

RBAC is the default authorizer in recent Kubernetes releases. It defines four resource types:

Role – namespaced permissions

ClusterRole – cluster‑wide permissions

RoleBinding – binds a Role to a user, group, or service account

ClusterRoleBinding – binds a ClusterRole to a subject

Typical commands to inspect RBAC objects:

kubectl get roles --all-namespaces
kubectl get clusterroles
kubectl get rolebindings --all-namespaces
kubectl get clusterrolebindings

System‑defined ClusterRoles (prefixed with system:) provide the baseline permissions for components such as the kubelet.

Webhook Authorization

External HTTPS services can make authorization decisions. The API server is configured with --authorization-webhook-config-file=webhook-config.yaml. See the official documentation for the file format.

Admission Control

Admission controllers are plugins that intercept requests after authorization but before persistence. If any plugin rejects the request, the operation fails.

AlwaysAdmit – allows all requests (default for testing)

AlwaysDeny – blocks all requests (testing)

AlwaysPullImages – forces image pull before container start

DenyEscalatingExec – blocks exec/attach on privileged pods

ServiceAccount – auto‑creates service‑account secrets

SecurityContextDeny – disables securityContext fields

ResourceQuota – enforces namespace resource quotas

LimitRanger – enforces limit ranges on pods/containers

NamespaceLifecycle – prevents creation in non‑existent namespaces and cleans up on deletion

PodSecurityPolicy – validates pod security settings

Recommended admission plugins for Kubernetes ≥1.6:

--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,ResourceQuota,DefaultTolerationSeconds

For Kubernetes ≥1.4 the recommended set is slightly smaller:

--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota
Service account token mounted in pod
Service account token mounted in pod
RBAC role binding diagram
RBAC role binding diagram
RBAC objects relationship diagram
RBAC objects relationship diagram
Admission controller list
Admission controller list
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeKubernetesAuthenticationAuthorizationRBACServiceAccountAdmission Control
Full-Stack DevOps & Kubernetes
Written by

Full-Stack DevOps & Kubernetes

Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.