Connect to Kubernetes using Boundary configuration
In this tutorial you take on the role of the operations
team to configure
Boundary, Vault, and Kubernetes to allow the developer
team to connect to
Kubernetes using Boundary.
Prerequisites
This tutorial requires you to have completed the Connect to Kubernetes using Boundary lab setup tutorial.
Configure Kubernetes
(Persona: operations
)
The operations
team needs to set up a Kubernetes service account, token, and
role which are used by Vault to manage service accounts in Kubernetes.
Create a Kubernetes namespace for Vault. This namespace is used to create a service account for Vault to interact with your Kubernetes cluster.
Create a service account named
vault
with a service token. The service account and token are used by Vault to authenticate with Kubernetes.Example output:
Create a cluster role for the
vault
service account. This role provides Vault with the necessary permissions to manage short-lived service accounts which will be requested by thedeveloper
team.Example output:
Associate the
vault
service account with the cluster role.Example output:
Retrieve the
vault
Kubernetes secret and store it as an environment variable.Decode the
ca.crt
certificate and store it as an environment variable.Decode the token and store it as an environment variable.
Verify the environment variables are set correctly. The
KUBE_API_URL
environment variable was set in the Deploy Vault section in the previous tutorial. If it is missing, return to the previous tutorial and export the enviroment variable again.If any of the values are empty, return to the previous steps and re-run the related command(s).
Configure Vault for Kubernetes
(Persona: operations
)
The operations
team needs to use the Kubernetes service account, token, and
associated secrets to configure the Kubernetes secret
engine.
Enable the Kubernetes secret engine.
Configure the Kubernetes secret engine with the settings for the Kubernetes cluster created in the previous section.
Example output:
Create a Vault role. The
generated_role_rules
parameter defines the permission granted to the service account Vault creates. Thedeveloper
team only needed to be able to list running pods.Example output:
Generate a new service account token using the Vault
auto-managed-sa-and-role
role.Example output:
Confirm the service account was created in Kubernetes.
The Kubernetes auth method is now configured and successfully created a short-lived service account in Kubernetes.
Configure Vault for Boundary
(Persona: operations
)
The operations
team needs to configure Vault to permit Boundary to manage an
orphan token, used to authenticate Boundary to Vault when a new Kubernetes
service account is requested.
Create a Vault policy to permit Boundary to manage its lease, including the
auto-managed-sa-and-role
role created previously.Example output:
Create a orphan token with the new policy attached. This token will be used to set up the Boundary credential store.
Example output:
Configure Boundary
(Persona: operations
)
The operations
team needs to configure resources in Boundary so the
developer
team has access to only the resources required by the team.
Authenticate with Boundary. Enter the username and password for your Boundary instance.
Create a new Boundary org and store the org ID as an environment variable.
Example output:
Create a new project in the DevOps org and store the project ID as an environment variable..
Example output:
Create a new credential store in the
kubernetes
project and store the credential store ID as an environment variable.Select the tab below that matches your Vault deployment type.
Example output:
Create a credential library and store the library ID as an environment variable.
Example output:
Create a target for the Kubernetes API URL and store the target ID as an environment variable.
Select the tab below that matches your Vault deployment type.
Example output:
Add the brokered credential store to the Kubernetes target.
Example output:
Next steps
Boundary, Vault, and Kubernetes have been configured to provide just-in-time access to the Kubernetes cluster.
In the Connect to Kubernetes using Boundary tutorial, you will broker credentials from Vault and establish a session to the Kubernetes cluster.