Kubernetes (Service Account)
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:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: <clusterrolebinding-name>
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
Create a RoleBinding or ClusterRoleBinding to associate the Role or ClusterRole with the ServiceAccount.
To create a RoleBinding:
kubectl create rolebinding <rolebinding-name> --role <role-name> --serviceaccount <serviceaccount-name>
To create a ClusterRoleBinding:
kubectl create clusterrolebinding <clusterrolebinding-name> --clusterrole <clusterrole-name> --serviceaccount <serviceaccount-name>
Create a Secret to manually generate a permanent token.
First save and complete the following yaml template:
apiVersion: v1 kind: Secret metadata: name: build-robot-secret annotations: kubernetes.io/service-account.name: <serviceaccount-name> type: kubernetes.io/service-account-token
Run:
kubectl apply -f template.yaml
If not done already, obtain the generated token by inspecting the Secret just created.
kubectl get secret spirit -o json | jq -r '.data.token'
Save the token in a safe place, as you will need it when adding your resource in the StrongDM Admin UI next.
Add Your Kubernetes (Service Account) Cluster in StrongDM
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.
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
Select 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 Strong Vault; 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.
Last updated
Was this helpful?