Skip to content

Commit

Permalink
backport of commit e796005 (hashicorp#20735)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
  • Loading branch information
hc-github-team-secure-vault-core and tomhjp committed May 24, 2023
1 parent 7ef9b8c commit 603aab1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 45 deletions.
31 changes: 25 additions & 6 deletions website/content/docs/platform/k8s/csi/configurations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,31 @@ Most settings support being set by, in ascending order of precedence:
If installing via the helm chart, they can be set using e.g.
`--set "csi.extraArgs={-debug=true}"`.

- `-cache-size` `(int: 1000)` - Set the maximum number of Vault tokens that will
be cached in-memory. One Vault token will be stored for each pod on the same
node that mounts secrets. Setting to 0 will disable the cache and force each
volume mount request to reauthenticate to Vault.

- `-debug` `(bool: false)` - Set to true to enable debug level logging.

- `-endpoint` `(string: "/tmp/vault.sock")` - Path to unix socket on which the
provider will listen for gRPC calls from the driver.

- `-health-addr` `(string: ":8080")` - (v0.3.0+) The address of the HTTP listener
- `-health-addr` `(string: ":8080")` - The address of the HTTP listener
for reporting health.

- `-vault-addr` `(string: "https://127.0.0.1:8200")` - (v0.3.0+) Default address
- `-hmac-secret-name` `(string: "vault-csi-provider-hmac-key")` - Configure the
Kubernetes secret name that the provider creates to store an HMAC key for
generating secret version hashes.

- `-vault-addr` `(string: "https://127.0.0.1:8200")` - Default address
for connecting to Vault. Can also be specified via the `VAULT_ADDR` environment
variable.
variable. **Note:** It is highly recommended to only set the Vault address when
installing the helm chart. The helm chart will install Vault Agent as a sidecar
to the Vault CSI Provider for caching and renewals, but setting `-vault-addr`
here will cause the Vault CSI Provider to bypass the Agent's cache.

- `-vault-mount` `(string: "kubernetes")` - (v0.3.0+) Default Vault mount path
- `-vault-mount` `(string: "kubernetes")` - Default Vault mount path
for Kubernetes authentication. Can be overridden per Secret Provider Class
object.

Expand Down Expand Up @@ -73,7 +85,11 @@ structure is illustrated in the [examples](/vault/docs/platform/k8s/csi/examples

- `roleName` `(string: "")` - Name of the role to be used during login with Vault.

- `vaultAddress` `(string: "")` - The address of the Vault server.
- `vaultAddress` `(string: "")` - The address of the Vault server. **Note:** It is
highly recommended to only set the Vault address when installing the helm chart.
The helm chart will install Vault Agent as a sidecar to the Vault CSI Provider
for caching and renewals, but setting `vaultAddress` here will cause the Vault
CSI Provider to bypass the Agent's cache.

- `vaultNamespace` `(string: "")` - The Vault [namespace](/vault/docs/enterprise/namespaces) to use.

Expand All @@ -94,8 +110,11 @@ structure is illustrated in the [examples](/vault/docs/platform/k8s/csi/examples

- `vaultTLSServerName` `(string: "")` - The name to use as the SNI host when connecting via TLS.

- `vaultAuthMountPath` `(string: "kubernetes")` - The name of the auth mount used for login.
Can be a Kubernetes or JWT auth mount. Mutually exclusive with `vaultKubernetesMountPath`.

- `vaultKubernetesMountPath` `(string: "kubernetes")` - The name of the auth mount used for login.
At this time only the Kubernetes auth method is supported.
Can be a Kubernetes or JWT auth mount. Mutually exclusive with `vaultAuthMountPath`.

- `audience` `(string: "")` - Specifies a custom audience for the requesting pod's service account token,
generated using the
Expand Down
4 changes: 0 additions & 4 deletions website/content/docs/platform/k8s/csi/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ spec:
provider: vault
parameters:
roleName: 'app'
vaultAddress: 'https://vault.vault:8200'
vaultCACertPath: '/vault/tls/ca.crt'
objects: |
- objectName: "dbUsername"
secretPath: "database/creds/db-app"
Expand Down Expand Up @@ -105,8 +103,6 @@ spec:
key: password
parameters:
roleName: 'app'
vaultAddress: 'https://vault.vault:8200'
vaultCACertPath: '/vault/tls/ca.crt'
objects: |
- objectName: "dbUsername"
secretPath: "database/creds/db-app"
Expand Down
47 changes: 12 additions & 35 deletions website/content/docs/platform/k8s/csi/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ At a high level, the CSI Secrets Store driver allows users to create `SecretProv
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 <span class="x x-first x-last">mount</span> them <span class="x x-first x-last">into</span> the pod<span class="x x-first x-last">'s CSI</span> volume.
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.
Expand All @@ -32,46 +32,21 @@ The following features are supported by the Vault CSI Provider:
- 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](/vault/docs/platform/k8s/helm)

@include 'kubernetes-supported-versions.mdx'

## Authenticating with Vault