Installing the HashiCorp Vault Secret CSI Driver
This content is authored by Red Hat experts, but has not yet been tested on every supported configuration.
The HashiCorp Vault Secret CSI Driver allows you to access secrets stored in HashiCorp Vault as Kubernetes Volumes.
Prerequisites
- An OpenShift Cluster (ROSA, ARO, OSD, and OCP 4.x all work)
- oc
- helm v3
Installing the Kubernetes Secret Store CSI
Create an OpenShift Project to deploy the CSI into
Set SecurityContextConstraints to allow the CSI driver to run (otherwise the DaemonSet will not be able to create Pods)
Add the Secrets Store CSI Driver to your Helm Repositories
Update your Helm Repositories
Install the secrets store csi driver
Check that the Daemonsets is running
You should see the following
Add pod security profile label for CSI Driver
This is required starting in OpenShift v4.13
Install HashiCorp Vault with CSI driver enabled
Add the HashiCorp Helm Repository
Update your Helm Repositories
Create a namespace for Vault
Create a SCC for the CSI driver
Create a values file for Helm to use
Install Hashicorp Vault with CSI enabled
Patch the CSI daemonset
Currently the CSI has a bug in its manifest which we need to patch
Configure Hashicorp Vault
Get a bash prompt inside the Vault pod
Create a Secret in Vault
Configure Vault to use Kubernetes Auth
Check your Cluster’s token issuer in another terminal
Configure Kubernetes auth method
If the issuer here does not match the above, update it.
Create a policy for our app
Create an auth role to access it
exit from the vault-0 pod
Deploy a sample application
Create a SecretProviderClass in the default namespace
Create a service account
webapp-saCreate a Pod to use the secret
Check the Pod has the secret
The output should match
Uninstall HashiCorp Vault with CSI driver enabled
Delete the pod and
Delete the Hashicorp Vault Helm
Delete the SCC for Hashicorp Vault
Delete the Hashicorp vault project
Uninstalling the Kubernetes Secret Store CSI
Delete the secrets store csi driver
Delete the SecurityContextConstraints