Glossary · Non-human identity

Service account

A service account is an identity created for an application, workload or automation to authenticate as, rather than for a person, and granted permissions through roles or bindings.

The term has a specific meaning on each platform. In Kubernetes, a ServiceAccount is a namespaced object that pods run as; the API server issues it tokens, and RoleBindings and ClusterRoleBindings decide what it may do. Every namespace has a default service account, used by any pod that names no other. In Google Cloud, a service account is a principal identified by an email address, which can hold IAM roles and, if allowed, user-managed keys. On AWS, the closest equivalents are IAM roles assumed by services and workloads, and on Azure, service principals and managed identities. Directory services and SaaS platforms have their own service or "bot" accounts.

How it is used in practice

Applications use service accounts to call APIs: a pod reads secrets from the Kubernetes API, a batch job writes to a cloud bucket, a deployment tool changes infrastructure. Platform teams create one service account per workload so that permissions and audit logs are specific, bind it to the narrowest role that works, and, in Kubernetes, link it to a cloud role through workload identity rather than mounting a cloud key. Security teams review service accounts like any other privileged identity: who owns it, what it can reach, and whether it is still used.

Common pitfalls

  • Using default. Permissions granted to a namespace's default account apply to every pod that forgot to name its own.
  • Automounted tokens. Kubernetes mounts a service-account token into pods by default; a pod that never calls the API still carries a credential an attacker can use.
  • Cluster-admin bindings. A single ClusterRoleBinding to cluster-admin turns one compromised pod into a compromised cluster.
  • Downloaded keys. Long-lived service-account keys exported from a cloud console tend to end up in repositories and laptops.
  • Orphans. Accounts outlive the projects that created them and keep their access.

How TrustIvan relates to it

TrustIvan reads service accounts in two places. In AppSec, a connected Kubernetes cluster's collection records each service account's token-automounting setting and bound cloud identity, the RBAC bindings that grant cluster-admin, and which workloads run as which account; automounted tokens and cluster-admin bindings are posture findings. In NHI Security, the Kubernetes, Google Cloud and other connectors inventory service accounts as identities with owners, credentials and relationships, so access analysis can follow a workload to the account it runs as and on to the role that account is bound to, and policies such as stale_identity and unowned_identity apply. See Connectors.

Related terms

Guides on Service account

On the platform: Identity governance. All glossary terms

See TrustIvan on your own estate.

Book thirty minutes with an engineer and bring an image, a repository or a cloud account, or start free on the hosted service.