Kubernetes ServiceAccount is a Kubernetes identity used by pods to authenticate to the Kubernetes API server and access cluster resources. In practical terms, it gives a workload its own cluster identity, so the application running in a pod can list ConfigMaps, read Secrets, create Jobs, call custom resources, or interact with other Kubernetes APIs when it has permission to do so.
A ServiceAccount answers a basic question inside a cluster: “Who is this pod acting as?”
When a pod talks to the Kubernetes API, the API server needs to authenticate the request and then check whether that identity is allowed to perform the requested action. A ServiceAccount provides that identity for workloads.
Common uses include:
ServiceAccounts are namespaced Kubernetes objects. A pod can reference a specific ServiceAccount in its pod spec. If you do not specify one, Kubernetes uses the namespace’s default ServiceAccount.
A basic pod configuration looks like this:
apiVersion: v1
kind: Pod
metadata:
name: example-app
spec:
serviceAccountName: app-reader
containers:
- name: app
image: example/app:1.0
When the pod starts, Kubernetes makes credentials available to the pod, usually through a projected token volume. The application can use that token to authenticate to the Kubernetes API server.
Authentication confirms the pod’s identity. Authorization is handled separately, usually through Kubernetes RBAC.
A ServiceAccount by itself does not grant useful permissions. You normally pair it with Role-Based Access Control, or RBAC.
The main RBAC objects are:
For example, an application that needs to read ConfigMaps in the payments namespace might use a ServiceAccount named payments-config-reader, a Role that allows get and list on ConfigMaps, and a RoleBinding that connects the two.
Suppose you run a reporting service in Kubernetes. The service needs to read a Secret named reporting-db-credentials and list Jobs in its namespace. You can create a dedicated ServiceAccount named reporting-service, grant it only those permissions with a Role, and bind the Role to that ServiceAccount.
This is safer than using the default ServiceAccount or giving the pod broad permissions. If the reporting service is compromised, the attacker gets only the permissions assigned to that workload, not broad access to the cluster.
Every namespace has a ServiceAccount named default. Pods use it automatically when you do not set serviceAccountName.
For production workloads, it is usually better to create a dedicated ServiceAccount per application or component. This makes permissions easier to audit and limits blast radius. You can also set automountServiceAccountToken: false for pods that do not need to call the Kubernetes API.
apiVersion: v1
kind: Pod
metadata:
name: no-api-access
spec:
automountServiceAccountToken: false
containers:
- name: app
image: example/app:1.0
A ServiceAccount token is the credential a pod uses to authenticate as its ServiceAccount. Modern Kubernetes clusters use short-lived, automatically rotated projected tokens by default. Older clusters often used long-lived Secret-based tokens, which are harder to secure and should be avoided where possible.
For security-sensitive clusters, check:
A ServiceAccount is for workloads running in the cluster, such as pods, controllers, and operators.
A Kubernetes user account represents a person or external system that authenticates to the API server, often through client certificates, OIDC, SSO, or a cloud provider’s IAM integration.
In cloud Kubernetes environments, ServiceAccounts are often connected to cloud IAM identities. For example, Amazon EKS supports IAM Roles for Service Accounts, commonly called IRSA. This lets a pod use an AWS IAM role through its Kubernetes ServiceAccount instead of storing AWS access keys in a Secret.
This pattern is common for workloads that need access to AWS services such as S3, SQS, DynamoDB, or Secrets Manager. It also matters when deploying platform tooling on EKS, such as in an Apache Airflow deployment on AWS EKS.
default ServiceAccount for production applications.get on one Secret instead of broad access to all Secrets.automountServiceAccountToken: false for workloads that do not call the Kubernetes API.cluster-admin.ServiceAccounts are often part of platform automation. Tools that create or manage infrastructure from Kubernetes need identities with specific permissions. For example, Crossplane uses Kubernetes resources and controllers to manage cloud infrastructure, and ServiceAccounts are part of how those controllers operate securely. You can see this pattern in workflows that deploy AWS resources using Crossplane on Kubernetes.
ServiceAccounts also matter during cluster maintenance. After upgrades, you should verify workloads that depend on API authentication, token behavior, RBAC, and cloud IAM integrations. This is especially useful when following practical Kubernetes upgrade tips for startups.
A Kubernetes ServiceAccount is the identity assigned to a pod so it can authenticate to the Kubernetes API. It becomes useful when combined with RBAC permissions, which define what that workload is allowed to do inside the cluster.