Planted .
Service accounts are namespaced, non-human accounts.
Kubernetes automatically creates a default service account for all namespaces in cluster. It is attached to all pods by default.
To attach a service account to a pod, use the serviceAccountName field.
When a service account is attached to a pod, Kubernetes:
- Automatically creates a token and mounts it as a projected volume.
- Automatically rotates tokens
- Automatically expires the token when the pod is deleted.
Use kuebctl get serviceaccounts to get the list.
Sample service account
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
kubernetes.io/enforce-mountable-secrets: "true"
name: my-serviceaccount
namespace: my-namespace Paths into this note
1 note leads here
-
To create a service account: