Service accounts are identities for machines rather than people, such as CI pipelines, GitOps controllers or scripts that work with your KDP workspace. You give a service account roles, then create long-lived tokens that an external application uses to authenticate.
Service accounts belong to the current organisation or project. See Organisations, Projects and Namespaces.
Keep two things in mind:
For the Kubernetes objects behind service accounts, see Members and service accounts.
Open Service Accounts in the sidebar. The table shows each service account’s namespace, roles, number of tokens and creation date. Each role is tagged Namespace or Cluster-wide. You can search by name or namespace, and filter by role or by whether a service account has tokens.
Service accounts named default are not listed.
To open this page you need permission to list serviceaccounts in the workspace.
Click Create Service Account.
Enter a Name. It can have at most 63 characters, contain only lowercase letters, digits and hyphens, and must start and end with a letter or digit.
Select the Namespace the service account lives in.
Select roles. You need at least one, from either list:
These are the same roles you assign to members; see Members and Roles.
Click Create Service Account.
To change the roles later, open the service account’s menu (…) and choose Update Roles.
This needs permission to create and delete rolebindings, or clusterrolebindings for
cluster-wide roles. Without the latter, the Cluster-wide roles list is disabled.
The dashboard only shows the token once, so copy it before closing the dialog. The value is still
stored in the token Secret: anyone who can read Secrets in that namespace can read the token. Give
get secrets permission in that namespace only to people who may use the service account.
To create tokens you need permission to create secrets in the namespace.
Use the token as a bearer token against the KDP API endpoint of the workspace. For example, to build a kubeconfig, download your own kubeconfig from the user menu (Download Kubeconfig), then replace the user credentials with the token:
kubectl config set-credentials my-ci-bot --token=<token>
kubectl config set-context --current --user=my-ci-bot
kubectl get <resource> --namespace <namespace>
The dashboard does not create a kubeconfig for service accounts.
On the service account’s details page, open the token’s menu (…) and choose Revoke token.
This deletes the token Secret, and the token stops working. You need permission to delete secrets
in the namespace.
Open the service account’s menu (…), choose Delete and type the service account name to
confirm. This deletes the service account together with its role bindings and all its tokens. If
the service account has cluster-wide roles, you also need permission to delete
clusterrolebindings.