Kubernetes (Service Account)
The Kubernetes (Service Account) resource type in StrongDM enables you to grant access to a self-managed or on-premises Kubernetes cluster by using a service account token for authentication.
Overview
This guide describes how to set up a Kubernetes cluster in StrongDM with the credentials of a Kubernetes service account. This process involves setting up a Kubernetes cluster, generating a permanent service account token, and using that token to configure a new Kubernetes (Service Account) cluster in the StrongDM Admin UI. When done with this guide, you will be able to use StrongDM to connect to a Kubernetes cluster with the credentials of a Kubernetes service account.
Prerequisites
Ensure that the API server you intend to add to StrongDM is accessible from your StrongDM nodes (gateways, relays, or proxy clusters). See our guide on Nodes for more information.
Configure the Kubernetes Cluster
Before you can add the cluster to your StrongDM environment, you need to set up the cluster itself. Follow these steps to configure your cluster.
Create a ServiceAccount:
kubectl create serviceaccount <serviceaccount-name>Create a Role or ClusterRole.
The following example ClusterRole gives blanket permissions to the whole cluster:
Create a RoleBinding or ClusterRoleBinding to associate the Role or ClusterRole with the ServiceAccount.
To create a RoleBinding:
To create a ClusterRoleBinding:
Create a Secret to manually generate a permanent token.
First save and complete the following yaml template:
Run:
If not done already, obtain the generated token by inspecting the Secret just created.
Save the token in a safe place, as you will need it when adding your resource in the StrongDM Admin UI next.
Resource Configuration in StrongDM
This section provides instructions for adding the resource in either the StrongDM Admin UI, CLI, Terraform provider, or SDKs.
Set up and Manage With the Admin UI
If using the Admin UI to add the resource to StrongDM, use the following steps.
Log in to the StrongDM Admin UI and go to Resources > Clusters.
Click Add cluster.
For Cluster Type, select Kubernetes (Service Account).
For API Token, set the token that you generated and saved in the previous section of this guide.
Set all other required resource properties to configure how the StrongDM node connects.
Click Create to save the resource.
The Admin UI updates and shows your new cluster in a healthy or unhealthy state. Healthy indicates a successful connection. If it is unhealthy, click into the cluster's name and view the Diagnostics tab to determine where the connection is failing.
Set up and Manage With the CLI
This section provides general steps on how to configure and manage the resource using the StrongDM CLI. For more information and examples, please see the CLI Reference documentation.
In your terminal or Command Prompt, log in to StrongDM:
Run
sdm admin clusters add`` ``k8s-service --helpto view the help text for the command, which shows you how to use the command and what options (properties) are available. Note which properties are required and collect the values for them.Then run
sdm admin clusters add`` ``k8s-service <RESOURCE_NAME>and set all required properties with their values. For example:Check that the resource has been added. The output of the following command should show the resource's name:
Set up and Manage With Terraform
This section provides an example of how to configure and manage the resource using the Terraform provider. For more information and examples, please see the Terraform provider documentation.
Set up and Manage With SDKs
In addition to the Admin UI, CLI, and Terraform, you may configure and manage your resource with any of the following SDK options: Go, Java, Python, and Ruby. Please see the following references for more information and examples.
Resource Properties
The following table describes the configuration properties available for your Kubernetes (Service Account) cluster.
Display Name
Required
Meaningful name to display the resource throughout StrongDM; exclude special characters like quotes (") or angle brackets (< or >)
Cluster Type
Required
Kubernetes (Service Account)
Proxy Cluster
Required
Defaults to "None (use gateways)"; if using proxy clusters, select the appropriate cluster to proxy traffic to this resource
Hostname
Required
Hostname or IP address of the API server, such as api.aks.example.com; relay server should be able to connect to your target server or hostname
Port
Required
Port to connect to the API server; default port value 443
Connectivity Mode
Required
Select either Virtual Networking Mode, which lets users connect to the resource with a software-defined, IP-based network; or Loopback Mode, which allows users to connect to the resource using the local loopback adapter in their operating system; this field is shown if Virtual Networking Mode enabled for your organization
IP Address
Optional
If Virtual Networking Mode is the selected connectivity mode, an IP address value in the configured Virtual Networking Mode subnet in the organization network settings; if Loopback Mode is the selected connectivity mode, an IP address value in the configured Loopback IP range in the organization network settings (by default, 127.0.0.1); if not specified, an available IP address in the configured IP address space for the selected connectivity mode will be automatically assigned; this field is shown if Virtual Networking Mode and/or multi-loopback mode is enabled for your organization
Port Override
Optional
If Virtual Networking Mode is the selected connectivity mode, a port value between 1 and 65535 that is not already in use by another resource with the same IP address; if Loopback Mode is the selected connectivity mode, a port value between 1024 to 64999 that is not already in use by another resource with the same IP address; when left empty with Virtual Networking Mode, the system assigns the default port to this resource; when left empty for Loopback Mode, an available port that is not already in use by another resource is assigned; preferred port also can be modified later from the Port Overrides settings
DNS
Optional
If Virtual Networking Mode is the selected connectivity mode, a unique hostname alias for this resource; when set, causes the desktop app to display this resource's human-readable DNS name (for example, k8s.my-organization-name) instead of the bind address that includes IP address and port (for example, 100.64.100.100:5432)
Secret Store
Optional
Credential store location; defaults to none (credentials are stored in StrongDM resource configuration); to learn more, see Secret Store options
API Token
Required
Permanent token associated with the ServiceAccount on the Kubernetes cluster
Healthcheck Namespace
Optional
If enabled for your organization, the namespace used for the resource healthcheck; defaults to default if empty; supplied credentials must have the rights to perform one of the following kubectl commands in the specified namespace: get pods, get deployments, or describe namespace
API Token
Required
Permanent token associated with the ServiceAccount on the Kubernetes cluster
Authentication
Required
Authentication method to access the cluster; select either Leased Credential (default) or Identity Aliases (to use the Identity Aliases of StrongDM users to access the cluster)
Identity Set
Required
Displays if Authentication is set to Identity Aliases; select an Identity Set name from the list
Healthcheck Username
Required
If Authentication is set to Identity Aliases, the username that should be used to verify StrongDM's connection to it; username must already exist on the target cluster
Resource Tags
Optional
Resource Tags consisting of key-value pairs <KEY>=<VALUE> (for example, env=dev)
Display name
Some Kubernetes management interfaces, such as Visual Studio Code, do not properly render cluster names containing spaces. If you run into problems, please choose a Display Name without spaces.
Secret Store
By default, server credentials are stored in StrongDM. However, these credentials can also be saved in a secrets management tool.
Non-StrongDM options appear in the Secret Store dropdown if they are created under Settings > Secrets Management. When you select another Secret Store type, its unique properties display. For more details, see Configure Secret Store Integrations.
Test the Connection
After creating the Kubernetes (Service Account) cluster resource in the Admin UI, navigate to Infrastructure > Clusters and locate your newly added cluster. The health indicator should turn green once connectivity and token authentication are validated.
On a test client using the StrongDM Desktop App or CLI, connect to the cluster and run a basic command such as:\
Confirm the command returns resources and the connection is routed through StrongDM.
If discovery is enabled, in the Admin UI verify that namespaces, roles, and service accounts appear under the cluster’s Discovery tab. This indicates StrongDM successfully queried the Kubernetes API.
If the health status remains red or yellow:
Verify the cluster’s hostname and port are correct and that the API endpoint is reachable from your relay or gateway.
Check that the service account token is valid and has sufficient permissions to access the API.
Confirm the
healthcheck_namespaceexists and the user specified inidentity_alias_healthcheck_usernamehas the appropriate access.Review the Diagnostics tab for authentication or network error logs.
Once connectivity is verified and you can successfully run Kubernetes commands, the cluster resource is ready. You can then assign roles, apply policies, and monitor access through StrongDM.
Help
If you encounter issues, please consult the StrongDM Help Center.
Be prepared to provide the following information to StrongDM Support, so that they can inspect logs and confirm node and resource health:
Resource name or ID
CLI error output or logs
Node name and region
Timestamps of failed attempts
Last updated
Was this helpful?

