Skip to content

Human Users vs. Machine Users in Kubernetes

Kubernetes distinguishes between Human Users (people) and Machine Users (machines/services).


Core Concept Comparison

CategoryHuman User (person)Machine User (machine/service)
SubjectDevelopers, administrators, operations teams, etc.Applications, CI/CD, monitoring bots, etc.
AuthenticationX.509 certificate, OIDC tokenServiceAccount token (JWT)
IdentifierCN (e.g., admin, john)system:serviceaccount:<ns>:<name>
GroupO (e.g., developers, admins)system:serviceaccounts
LifetimeLong-lived (1 year+) or OIDC (1 hour)Short-lived (auto-rotated), tied to the Pod lifetime
Use caseskubectl commands, manual administrative tasksAPI calls from inside a Pod, automation scripts

Characteristics by User Type

1. Human User

A human user is a real person who connects from outside the cluster through tools such as kubectl. Because Kubernetes has no User object of its own, users are identified through externally issued credentials.

  • Certificate-based: The Common Name (CN) field of the client certificate is recognized as the user name.
  • OIDC-based: The email or ID in a token issued by an external identity provider such as Google or Okta is recognized as the user.

2. Machine User (ServiceAccount)

A machine user is an account that Pods inside the cluster or automation tools use when communicating with the API server. Because it is a Kubernetes API object (ServiceAccount), it can be freely created and deleted.

    flowchart LR
    Pod[Application Pod] -- "Present JWT token" --> APIServer[API Server]
    APIServer -- "Validate token" --> AuthN{Authentication succeeded?}
    AuthN -- "Identify SA" --> RBAC[Authorization check]
  
  • Automatic creation: A ServiceAccount named default is automatically created in every Namespace.
  • Automatic mounting: The token of the ServiceAccount specified in the Pod spec (or default if none is specified) is automatically mounted inside the Pod at /var/run/secrets/kubernetes.io/serviceaccount/.

Security Considerations

User typeSecurity threatMitigation
Human UserLeaked private key/tokenUse MFA (multi-factor authentication); short-lived OIDC tokens recommended
Machine UserPrivilege abuse if a Pod is compromisedApply the principle of least privilege; disable automatic token mounting where it is not needed

Understanding the difference between the two user types and choosing the appropriate authentication method is the key to cluster security.