Skip to main content

Service accounts from Kubernetes

The Kubernetes connector can also add your cluster's service accounts to your non-human identity inventory, and show which workloads run as each one.

This option is off by default. The connector itself is described in Kubernetes.

What you see in Mesh​

  • Each service account appears as a non-human identity of kind Service account, named namespace/name.
  • The default service account of each namespace is labelled default service account.
  • Each Deployment, StatefulSet, DaemonSet, Job and bare Pod is linked to the service account it runs as, in the Permission flow tab. A Job started by a CronJob appears as the Job.
  • Kubernetes does not record owners, so these identities have no stated owner and show No owner unless Mesh suggests one. See Suggested owners.
  • A deleted service account is marked deleted after the next complete collection, and restored if you recreate it.

The Service accounts list under Non-human identities, showing each service account's type, connector, risk severity and when it was last updated

The Permission flow tab of a service account, showing the Deployment that runs as it

Permission to add​

Add read access to service accounts to the read-only role you created for the connector:

- apiGroups: [""]
resources: ["serviceaccounts"]
verbs: ["list"]

Mesh does not read Kubernetes Secrets. Without this permission, a collection reports incomplete.

Turn it on in Mesh​

  1. On the Connectors page, open your Kubernetes connector for editing.
  2. On the Collection tab, under What Mesh reads, in Identities, turn on Service accounts.
  3. Save the connector.

Turning Service accounts off stops new links, but service accounts Mesh already collected stay in Mesh.

Troubleshooting​

SymptomLikely causeWhat to do
No service accounts appearService accounts is offTurn it on
The collection reports incompleteThe role cannot list serviceaccountsAdd the rule above
A workload has no Permission flow linkIts type is not listed above, or it has no Pods running, for example a Deployment scaled to zeroExpected; only the listed types are linked, and only while they have Pods