Vault CSI provider
The Vault CSI Provider allows pods to consume Vault secrets using CSI Secrets Store volumes.
The Vault CSI Provider requires the CSI Secret Store Driver to be installed.
Overview
At a high level, the CSI Secrets Store driver allows users to create SecretProviderClass
objects.
This object defines which secret provider to use and what secrets to retrieve. When pods requesting CSI volumes
are created, the CSI Secrets Store driver will send the request to the Vault CSI Provider if the provider
is vault
. The Vault CSI Provider will then use Secret Provider Class specified and the pod's service account to retrieve
the secrets from Vault, and mount them into the pod's CSI volume.
The secret is retrieved from Vault and populated to the CSI secrets store volume during the ContainerCreation
phase.
This means that pods will be blocked from starting until the secrets have been read from Vault and written to the volume.
Features
The following features are supported by the Vault CSI Provider:
- All Vault secret engines supported.
- Authentication using the requesting pod's service account.
- TLS/mTLS communications with Vault.
- Rendering Vault secrets to files.
- Dynamic lease caching and renewal performed by Agent.
- Syncing secrets to Kubernetes secrets to be used as environment variables.
- Installation via Vault Helm
Supported kubernetes versions
The following Kubernetes minor releases are currently supported. The latest version is tested against each Kubernetes version. It may work with other versions of Kubernetes, but those are not supported.
- 1.26
- 1.25
- 1.24
- 1.23
- 1.22
Authenticating with Vault
The Vault CSI Provider will authenticate with Vault as the service account of the pod that mounts the CSI volume. Kubernetes and JWT auth methods are supported. The pod's service account must be bound to a Vault role and a policy granting access to the secrets desired.
It is highly recommended to run pods with dedicated Kubernetes service accounts to ensure applications cannot access more secrets than they require.
Secret provider class example
The following is an example of a Secret Provider Class using the vault
provider:
Secret Provider Class is a namespaced object in Kubernetes.
Using secret provider classes
An application pod uses the example Secret Provider Class above by mounting it as a CSI volume:
In this example volumes.csi
is created on the application deployment and references
the Secret Provider Class named vault-db-creds
.
Tutorial
Refer to the Vault CSI Provider tutorial to learn how to set up Vault and its dependencies with a Helm chart.