Join our Newsletter — 33% off our NHI Course
Home› Guides› Reading Service Account Activity in Kubernetes Audit Logs:…
Guide Cloud & Workload Identity

Reading Service Account Activity in Kubernetes Audit Logs: Fields, Signals and Detections That Work

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 12 min read
On this page

Most Kubernetes API traffic comes from service accounts, yet most teams cannot say what a given service account actually did last week. The audit log already holds the answer: every request a workload or controller makes carries a service account username, a verb, an object and, for bound tokens, the pod and token ID it came from. This guide shows platform security and NHI teams how to read those events, which fields identify the workload behind a request, how to spot a token being used from outside the cluster, and where to find the same data on AKS, EKS and GKE. It assumes audit logging is already switched on; for audit policy design and general detections across all identities, see the Kubernetes Audit Log Detection Guide.

Key takeaways

  • The username tells you who, the extra fields tell you where. system:serviceaccount:<namespace>:<name> names the account, while authentication.kubernetes.io/pod-name, pod-uid and credential-id tie a request to a specific pod and token.
  • Singular is a user, plural is a group. system:serviceaccount: prefixes usernames and system:serviceaccounts: prefixes groups, and RBAC bindings to the plural group grant every service account in scope.
  • A missing pod name is a signal. A request authenticated as a service account with no pod binding comes from a manually issued or legacy Secret token, which can be used from anywhere the token has travelled.
  • Source IP plus user agent catches stolen tokens. Workload tokens should arrive from pod or node addresses with the workload's own client string, not from an external address with a kubectl user agent.
  • Baseline per service account, not per cluster. Each workload calls a small, stable set of verbs and resources, so deviations from that set are among the highest-fidelity alerts available.

Audit policy prerequisites

Service account analysis depends on what the audit policy keeps. The rules that matter for this page:

  • Metadata level at minimum for everything a workload can touch: user, groups, extra, verb, objectRef, sourceIPs, userAgent and responseStatus are all present at Metadata. Request bodies are only needed where the body is the signal (pod specs, RBAC objects).
  • Do not drop service accounts wholesale: a level: None rule scoped to system:serviceaccounts to cut noise removes the very activity this guide reads. Scope noise rules to named controllers and resources, such as leader election leases.
  • Keep reads: get, list and watch on secrets, configmaps and the API discovery endpoints are how token theft and reconnaissance show up. On AKS, the kube-audit-admin category excludes get and list, so it alone cannot answer "which service account read this Secret".
  • Keep token requests visible: serviceaccounts/token (the TokenRequest subresource) at Metadata, so you can see who minted a token for which account without storing the token.
  • Retention long enough to baseline: 30 days of hot data is a practical minimum for building per-account baselines; see the CIS Control 8 Audit Log Management Guide for retention and integrity.

Identifying service account requests

Kubernetes documentation states that service accounts authenticate with the username system:serviceaccount:(NAMESPACE):(SERVICEACCOUNT) and are assigned to the groups system:serviceaccounts and system:serviceaccounts:(NAMESPACE). Every authenticated request also carries system:authenticated. Filtering on the username prefix gives you all workload and controller traffic; filtering on the namespace segment lets you hand each team the activity of its own accounts.

Which token type made the request

The extra fields in user.extra show how the token was issued. The documentation's TokenReview example for a pod-bound token shows these keys:

Extra keyWhat it holdsHow to use it
authentication.kubernetes.io/credential-idJTI=<uuid>, the token's unique IDGroup all requests made with one token; spot the same JTI from two different source IPs
authentication.kubernetes.io/pod-name and pod-uidThe pod the token is bound toMap activity to a workload; a token whose pod UID no longer exists is refused by the API server
authentication.kubernetes.io/node-name and node-uidThe node the bound pod was scheduled toCompare with the source IP; the docs note this node data is not verified by kube-apiserver, so treat it as context, not proof
No pod or node keysA token not bound to a pod: kubectl create token without a bound object, or a legacy kubernetes.io/service-account-token SecretInvestigate: these tokens work from any network location until they expire or are deleted

Projected tokens mounted by the kubelet are bound to the pod, so in a healthy cluster almost all workload traffic carries pod keys. The live Kubernetes Service Account Token Guide covers token types and lifetimes in depth.

Legacy token markers

In Kubernetes 1.30 and later (the cleaner is stable from 1.30), auto-generated legacy Secret tokens that stay unused are marked invalid (default one year) and later purged. If someone presents an invalidated token, the API server adds the audit annotation authentication.k8s.io/legacy-token-invalidated: <secret name>/<namespace>, increments invalid_legacy_auto_token_uses_total and updates the Secret label kubernetes.io/legacy-token-last-used. Any hit on that annotation means an old token is still circulating, often in a CI system or a laptop kubeconfig.

Key fields (user, verb, objectRef, sourceIPs)

The live audit detection guide lists every event field. The table below reads the same fields through a service account lens.

FieldNormal for a workload service accountWorth a second look
user.usernameMatches the pod's spec.serviceAccountNameThe default account of a namespace making write calls; an account from one namespace acting in another
impersonatedUserAbsentPresent: a service account using impersonation headers to act as another identity
verbA short stable set, for example get and watch on configmapsFirst-ever create, patch or delete; list across all namespaces
objectRef (resource, subresource, namespace)The resources in the workload's Rolesecrets, pods/exec, serviceaccounts/token, clusterrolebindings, selfsubjectrulesreviews
sourceIPsPod CIDR or node addressesAddresses outside the cluster's pod and node ranges
userAgentThe workload's client library string, stable across versionskubectl/, curl/ or a scripting library when the workload normally uses something else
responseStatus.codeMostly 200 and 201Bursts of 403: the account is probing what it may do
annotations["authorization.k8s.io/reason"]The expected Role or ClusterRole bindingA binding to system:serviceaccounts or a wide ClusterRole that nobody intended for this workload

Source IPs need care. Behind a load balancer or proxy the first address may be the intermediary, and on managed control planes traffic from nodes may be translated. Record what "normal" looks like for each cluster before you alert on it.

Suspicious patterns

Each pattern below is a reading of service account events, mapped to MITRE ATT&CK where the technique fits.

PatternWhat you see in the eventsATT&CK
Token reuse from outside the clusterSame credential-id or same pod-bound username from a non-cluster source IP, often with a different user agentT1528 Steal Application Access Token; T1550.001 Application Access Token
Reconnaissance with a workload tokenselfsubjectrulesreviews or selfsubjectaccessreviews creates, wide list calls, 403 burstsT1613 Container and Resource Discovery
Secret harvestingget or list on secrets by an account that never read them before, or across namespacesT1552.007 Container API
Exec from a workload identitycreate on pods/exec or pods/attach by a service account other than a known operator or CI accountT1609 Container Administration Command
Token minting for another accountcreate on serviceaccounts/token where the caller is not the kubelet or an approved controllerT1528 Steal Application Access Token
RBAC self-escalationcreate or patch on rolebindings or clusterrolebindings naming the caller's own accountT1098.003 Additional Cloud Roles (closest fit)
Default account in usesystem:serviceaccount:<ns>:default making write callsT1078.001 Default Accounts

The Kubeflow campaign shows the pattern in practice: attackers reached notebook servers through exposed dashboards and used the mounted service account to create workloads in the namespace. In audit terms that is a notebook account issuing first-ever create calls on deployments or pods. See the Kubeflow cryptomining attacks.

Managed cluster audit logs

The managed services hold the same Kubernetes audit events but expose them in their own logging products. Platforms are listed alphabetically; each is a customer-side setting.

PlatformHow to collectWhere service account events landField to filter on
Azure Kubernetes Service (AKS)Diagnostic setting with kube-audit (all events) and optionally kube-audit-admin (excludes get and list); resource-specific mode recommendedLog Analytics tables AKSAudit and AKSAuditAdmin, or AzureDiagnostics in Azure diagnostics modeThe event's user.username, sourceIPs and verb
Amazon Elastic Kubernetes Service (EKS)Enable the audit control plane log type, plus authenticator to see IAM to Kubernetes mappings; each type is enabled individuallyCloudWatch Logs group /aws/eks/<cluster>/cluster, streams named kube-apiserver-audit-<id>user.username, user.extra, sourceIPs in the JSON event
Google Kubernetes Engine (GKE)Admin Activity audit logs are always on; Data Access logs (which include reads) must be enabledCloud Logging, resource type k8s_cluster, logs cloudaudit.googleapis.com%2Factivity and cloudaudit.googleapis.com%2Fdata_accessprotoPayload.authenticationInfo.principalEmail, protoPayload.requestMetadata.callerIp, protoPayload.methodName (form io.k8s.<group>.<version>.<resource>)

Availability notes: AKS documentation warns that kube-audit collection can be costly and suggests resource-specific tables configured as Basic logs. On EKS and GKE, check the provider's logging pricing before enabling read-inclusive streams. On every platform, service account secret reads appear only when the read-inclusive stream is collected. For platform hardening beyond logging, see the Azure Kubernetes Service Security Hardening Guide, the Amazon EKS Security Hardening Guide and the GKE Security Hardening Guide.

Building detections

  1. Inventory the accounts: list every service account and the pods that use it. Accounts with no pods are candidates for removal; see How to find unused Kubernetes service accounts.
  2. Record network ranges: pod CIDRs, node subnets, control plane and any NAT addresses per cluster. Store them as a lookup table in the SIEM.
  3. Build a per-account baseline: over 14 to 30 days, record for each username the set of (verb, resource, subresource, namespace) tuples and user agents. This is usually a few dozen rows per workload.
  4. Write the external-use rule first: alert when a system:serviceaccount: username succeeds from an address outside the lookup table. This is the highest-value single rule and has few false positives once ranges are right.
  5. Add the unbound-token rule: alert on service account requests with no authentication.kubernetes.io/pod-name key, excluding a short allowlist of CI accounts that legitimately use TokenRequest tokens. Also alert on any legacy-token-invalidated annotation.
  6. Add deviation rules: new tuple for an account (start in report-only mode), sensitive-resource access (secrets, exec, token, RBAC) outside the baseline, and 403 bursts above a threshold.
  7. Correlate with JTI: the same credential-id seen from two source IPs within a short window means one token, two holders.
  8. Tune and promote: run new rules silently for two weeks, review every hit with the owning team, then promote to alerting. Roll back a rule by returning it to report-only rather than deleting it.

The broader method for writing and testing identity detections is in the Detection Engineering for Non-Human Identities Guide.

Measuring it

  • Attribution rate: share of service account requests carrying pod keys (target: close to 100% outside named CI accounts).
  • Baseline coverage: share of active service accounts with a baseline older than 14 days.
  • External-use alerts: count per month and time to triage; each should end in a confirmed benign source or a revoked token.
  • Legacy token hits: legacy-token-invalidated annotations and legacy Secret tokens in use, trending to zero.
  • Default account writes: number of write calls by default accounts, trending to zero.

Where identity fits

Audit analysis tells you what a service account did; RBAC decides what it could do. Use the observed tuple set to tighten each Role to the verbs and resources the workload really uses, turn off automountServiceAccountToken for pods that never call the API, and replace long-lived Secret tokens with bound tokens. The Kubernetes NHI Security Guide covers the identity model, and How to rotate a Kubernetes service account token and detect old token use covers cutover.

Framework mapping

FrameworkReferenceHow this page applies
NIST SP 800-53 Rev. 5AU-2, AU-6, AU-12Log service account events and review them against baselines
NIST SP 800-53 Rev. 5AC-6(9), AC-2Log use of privileged functions; manage and remove unused accounts
NIST CSF 2.0DE.CM-03, DE.CM-09, DE.AE-02Monitor technology usage and runtime environments; analyse anomalies
CIS Controls v8.1Control 8 Audit Log ManagementCollect, retain and review audit logs
MITRE ATT&CK v20T1528, T1550.001, T1552.007, T1609, T1613, T1078.001Techniques visible through service account audit events

Practitioner checklist

  • Confirm the audit policy logs service account reads, serviceaccounts/token and pods/exec at Metadata or higher.
  • On AKS collect kube-audit, on EKS enable audit and authenticator, on GKE enable Data Access logs where reads matter.
  • Keep a lookup of pod, node and NAT ranges per cluster in the SIEM.
  • Alert on any service account request from outside those ranges.
  • Alert on service account requests with no pod binding, outside a named allowlist.
  • Alert on every authentication.k8s.io/legacy-token-invalidated annotation.
  • Baseline verb and resource tuples per account and review new tuples weekly.
  • Correlate requests by credential-id to catch one token used from two places.
  • Feed observed tuples back into Role reviews to shrink permissions.

Standards and references

Related NHI Mgmt Group resources: Kubernetes Audit Log Detection Guide · Kubernetes Service Account Token Guide · Kubernetes NHI Security Guide · Detection Engineering for Non-Human Identities Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.