Set up Kubernetes and Vault for Boundary
In this tutorial you will take on the role of the operations
team to deploy
Boundary, Vault, and Kubernetes.
Prerequisites
This tutorial requires you to have completed the Connect to Kubernetes using Boundary introduction tutorial.
Deploy Kubernetes
(Persona: operations
)
minikube is a CLI tool that provisions and manages the lifecycle of single-node Kubernetes cluster locally on your system.
Deploy a Kubernetes cluser using minikube.
Open a new terminal session.
Create a new working directory in your home directory called
boundary-kubernetes
to complete the lab exercises. Execute all commands from this working directory unless otherwise specified.Start a Kubernetes cluster.
The initialization process takes several minutes as it retrieves any necessary dependencies and executes various container images.
Verify the status of the Minikube cluster.
Kubernetes is now set up.
Start a pod that represents a production workload a
developer
may need to view.
Deploy Boundary
(Persona: operations
)
HashiCorp Boundary is an identity-aware proxy aimed at simplifying and securing least-privileged access to cloud infrastructure.
In this workflow you will test integrating Kubernetes with Boundary's dev mode.
Note
As of version 4.13.0 of Docker, you need to enable Allow the default Docker socket to be used in the Advanced settings section to run Boundary in dev mode.
Open a new terminal window, and start Boundary in
dev
mode:Dev mode starts Boundary to listen on port
9200
and with a pre-configured administrative user namedadmin
and a password ofpassword
. You will use the admin username and password to authenticate with Boundary.Return to the terminal you started Kubernetes in and set the
BOUNDARY_ADDR
environment variable.Boundary is now set up.
Deploy Vault
(Persona: operations
)
Vault is an identity-based secrets and encryption management system. Vault can generate secrets on-demand for some systems, such as AWS, and Kubernetes.
Select the appropriate tab to deploy an HCP Vault Dedicated cluster or deploy a Vault in dev mode.
Launch the HCP Portal and login.
From the Overview page, click Vault in the left navigation menu.
From the Vault overview click Create cluster under the Start from scratch section.
Select your preferred cloud provider.
Click the Vault tier pull down menu and select Development.
Click the Cluster size pull down menu and select Extra Small.
Under the Network section, accept or edit the Network ID, Region selection, and CIDR block for the HVN.
Leave Cluster accessibility set to Public.
Security consideration
All new development tier Vault Dedicated clusters are configured with public access enabled by default. This means clients can connect from anywhere. For production tiers (starter, standard, and plus) private access will be enabled by default. This means you can only connect from a transit gateway or peered VPC (AWS) or VNet (Azure).
Under the Basics section, accept or edit the default Cluster ID (
vault-cluster
).Under Templates, select Start from scratch.
Click Create cluster.
Wait for the cluster to initialize before proceeding.
Under Quick actions, click Public Cluster URL.
Return to the terminal you started Kubernetes in and set the
VAULT_ADDR
environment variable to the copied URL.Return to the Overview page and click Generate token.
Within a few moments a new token will be generated.
Copy the Admin Token.
Return to the terminal you started Kubernetes in and set the
VAULT_TOKEN
environment variable to the copied token.Set the
VAULT_NAMESPACE
environment variable toadmin
.Open a new terminal window, and start a proxy to expose the Kubernetes API.
Leave this terminal open with the proxy running.
Open a new terminal window, and start ngrok and create a tunnel to the proxy listening on port
8001
.Warning
ngrok is used to expose the Kubernetes API to Vault Dedicated. Using
--scheme=http
exposes the API without encryption to avoid TLS certificate errors.For production workloads, use a private peering or transit gateway connection with trusted certificates.
Example output:
Leave this terminal open with ngrok running.
Copy the ngrok forwarding address.
Return to the terminal you started Kubernetes in and set an environment variable for the ngrok forwarding address.
Vault Dedicated is now set up.
Validate lab setup
The tutorials in this series use environment variables to simplify the provided commands.
Verify all necessary environment variables are set.
If you are missing any of the environment variables, go back and verify each product is running and set the required variables.
HCP Vault Dedicated
VAULT_NAMESPACE
is only required when using Vault Dedicated and will not be present when following the Vault Dev mode workflow.Verify connectivity by authenticating to Boundary. Enter the admin username and password when prompted.
Verify connectivity to Vault.
Verify connectivity to Kubernetes.
A local
minikube
cluster will be listed undercontexts
.
Next steps
Boundary, Vault, and Kubernetes have been deployed and are ready to be configured.
In the Connect to Kubernetes using Boundary configuration tutorial, you will configure Kubernetes, configure Vault for Kubernetes, and configure Boundary to broker credentials from Vault to the Kubernetes cluster.