apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
managementState: Managed
To improve secret security and integrate with enterprise secret management systems, you can use the Secrets Store CSI Driver Operator to mount secrets from external stores without persisting them on the cluster after pod termination.
The Secrets Store CSI Driver Operator mounts secrets from external secret management systems, such as Azure Key Vault, into pods by using a provider plugin. The secrets do not persist on the system after pod termination.
Secret objects are stored with Base64 encoding. etcd provides encryption at rest for these secrets, but when secrets are retrieved, they are decrypted and presented to the user. If role-based access control is not configured properly on your cluster, anyone with API or etcd access can retrieve or modify a secret. Additionally, anyone who is authorized to create a pod in a namespace can use that access to read any secret in that namespace.
The Secrets Store CSI Driver Operator, secrets-store.csi.k8s.io, enables OKD to mount multiple secrets, keys, and certificates stored in enterprise-grade external secrets stores into pods as a volume. The Secrets Store CSI Driver Operator communicates with the provider using gRPC to fetch the mount contents from the specified external secrets store. After the volume is attached, the data in it is mounted into the container’s file system. Secrets store volumes are mounted in-line.
For more information about CSI inline volumes, see "CSI inline ephemeral volumes".
Familiarity with persistent storage and configuring CSI volumes is recommended when working with a CSI driver. For more information, see "Understanding persistent storage" and "Configuring CSI volumes".
You can store sensitive application data in an external secret management system and use the Secrets Store CSI Driver Operator to mount the secret content as a pod volume.
The Secrets Store CSI Driver Operator has been tested with the following secrets store providers:
AWS Secrets Manager
AWS Systems Manager Parameter Store
Azure Key Vault
Google Secret Manager
HashiCorp Vault
|
IBM Z supports only HashiCorp Vault. |
|
Red Hat does not test all factors associated with third-party secrets store provider functionality. For more information about third-party support, see the "Red Hat third-party support policy". |
The Container Storage Interface (CSI) enables storage vendors to deliver plugins through a standard interface without modifying Kubernetes core code, replacing traditional embedded storage drivers.
CSI Operators give OKD users storage options, such as volume snapshots, that are not possible with in-tree volume plugins.
You can use certain secrets store providers in disconnected OKD clusters by configuring VPC endpoints or equivalent connectivity to enable communication between the driver and external secret management systems.
The following secrets store providers support using the Secrets Store CSI driver in disconnected clusters:
AWS Secrets Manager
Azure Key Vault
Google Secret Manager
HashiCorp Vault
To enable communication between Secrets Store CSI driver and the secrets store provider, configure Virtual Private Cloud (VPC) endpoints or equivalent connectivity to the corresponding secrets store provider, the OpenID Connect (OIDC) issuer, and the Secure Token Service (STS). The exact configuration depends on the secrets store provider, the authentication method, and the type of disconnected cluster.
|
For more information about disconnected environments, see "About disconnected environments". |
The Secrets Store CSI Driver Operator uses pre-defined NetworkPolicies to control ingress and egress traffic for enhanced security of the Operator and driver components.
The following table summarizes the default ingress and egress rules:
| Component | Ingress ports | Egress ports | Description |
|---|---|---|---|
Secrets Store CSI Driver Operator |
|
|
Accesses metrics and communicates with the API server |
Secrets Store CSI driver |
|
|
Accesses metrics and communicates with the API server |
To enable OKD to mount secrets from external secret management systems, install the Secrets Store CSI Driver Operator and create a ClusterCSIDriver instance.
Access to the OKD web console.
Administrator access to the cluster.
Install the Secrets Store CSI Driver Operator:
Log in to the web console.
Click Ecosystem → Software Catalog.
Locate the Secrets Store CSI Driver Operator by typing "Secrets Store CSI" in the filter box.
Click the Secrets Store CSI Driver Operator button.
On the Secrets Store CSI Driver Operator page, click Install.
On the Install Operator page, ensure that:
All namespaces on the cluster (default) is selected.
Installed Namespace is set to openshift-cluster-csi-drivers.
Click Install.
After the installation finishes, the Secrets Store CSI Driver Operator is listed in the Installed Operators section of the web console.
Create the ClusterCSIDriver instance for the driver (secrets-store.csi.k8s.io):
Click Administration → CustomResourceDefinitions → ClusterCSIDriver.
On the Instances tab, click Create ClusterCSIDriver.
Use the following YAML file:
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
managementState: Managed
Click Create.
The Secrets Store CSI driver is typically installed in the namespace openshift-cluster-csi-drivers. This namespace is present in the cluster as part of the installation of the Cluster Storage Operator.
Create an OperatorGroup object by running the following command:
$ oc apply -f - <<EOF
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openshift-cluster-csi-drivers
namespace: openshift-cluster-csi-drivers
spec: {}
EOF
Create a Subscription object by running the following command:
$ oc apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: secrets-store-csi-driver-operator
namespace: openshift-cluster-csi-drivers
spec:
channel: stable
installPlanApproval: Automatic
name: secrets-store-csi-driver-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
EOF
Wait for the Operator to be up and running. You can check the Operator status by running the following command:
$ oc get csv -n openshift-cluster-csi-drivers
NAME DISPLAY VERSION RELEASE REPLACES PHASE
secrets-store-csi-driver-operator.v4.22.0-202607151755 Secrets Store CSI Driver Operator 4.22.0-202607151755 Succeeded
Create the Cluster CSI driver by running the following command:
$ oc apply -f - <<EOF
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
managementState: Managed
EOF
Verify that the Operator is running:
$ oc get operator -n openshift-cluster-csi-drivers
NAME AGE
secrets-store-csi-driver-operator.openshift-cluster-csi-drivers 7m55s
Verify that the pods are running:
$ oc get pods -n openshift-cluster-csi-drivers
NAME READY STATUS RESTARTS AGE
....
....
secrets-store-csi-driver-node-bhp2d 3/3 Running 0 45s
secrets-store-csi-driver-operator-74696fc7bc-qjrl8 1/1 Running 0 7m40s
You can configure secret rotation intervals to control how often mounted secrets are refreshed from external stores, or disable rotation for static secrets based on your specific security and operational requirements.
By default, secret rotation is enabled. When rotation is enabled, the Secrets Store CSI Driver Operator polls the external secret store at a configurable interval to check for secret updates. This process ensures that updates in the external store are automatically reflected in your pods and secrets. By default, polling interval is 2 minutes.
If you enabled synchronization of mounted content as Kubernetes secrets, the Kubernetes secrets are also rotated when the external secrets are updated.
Applications consuming the secret data must watch for file system changes to detect updated secrets. The Secrets Store CSI Driver Operator updates the content of the mounted volume, and applications should reload the secrets when changes are detected.
The Secrets Store CSI Driver Operator is installed on the cluster.
You have access to the cluster with cluster-admin privileges.
Edit the ClusterCSIDriver custom resource for the Secrets Store CSI Driver Operator by running the following command:
$ oc edit clustercsidrivers.operator.openshift.io secrets-store.csi.k8s.io
Locate or add the secretRotation section under spec.driverConfig.secretsStore. To enable secret rotation with a custom polling interval, set the type to Custom and configure the minimumRefreshAge field:
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
secretRotation:
type: Custom
custom:
minimumRefreshAge: 300
where:
spec.driverConfig.secretsStore.secretRotation.typeSpecifies the secret rotation mode. Set to Custom to enable secret rotation with a custom interval, or None to disable rotation. When rotation is disabled, secrets are fetched only at initial pod mount time.
spec.driverConfig.secretsStore.secretRotation.custom.minimumRefreshAgeSpecifies the minimum number of seconds between rotation attempts. Valid range is 1 to 31,560,000 seconds (approximately 1 year). If omitted when type is Custom, the platform applies a default of 120 seconds.
|
Choose a refresh interval based on your security and cost requirements:
|
To disable secret rotation completely, set the type field to None:
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
secretRotation:
type: None
When rotation is disabled, secrets are fetched only at initial pod mount time and are not updated thereafter, even if the values change in the external secret store.
Save and apply the changes to the custom resource.
Verify that the Secrets Store CSI Driver Operator driver pods are updated with the new configuration by running the following command:
$ oc get pods -n openshift-cluster-csi-drivers | grep secrets-store
secrets-store-csi-driver-node-bhp2d 3/3 Running 0 45s
secrets-store-csi-driver-node-xyz12 3/3 Running 0 45s
secrets-store-csi-driver-operator-74696fc7bc-qjrl8 1/1 Running 0 7m40s
Check the ClusterCSIDriver configuration to confirm the rotation settings by running the following command:
$ oc get clustercsidrivers.operator.openshift.io secrets-store.csi.k8s.io -o jsonpath='{.spec.driverConfig.secretsStore.secretRotation}' | jq
{
"custom": {
"minimumRefreshAge": 300
},
"type": "Custom"
}
For pods that mount secrets from the external store, monitor the file system to verify that the CSI driver rotates secrets according to the configured interval.
You can configure the Secrets Store CSI Driver Operator to use Workload Identity Federation (WIF) by specifying the service account token audience. This enables secure, credential-free authentication to external secret management systems across multiple cloud providers.
Workload Identity Federation allows your OKD workloads to access cloud provider services without storing long-lived credentials. Instead, the Secrets Store CSI Driver Operator uses short-lived service account tokens with a specified audience to authenticate to external secret stores.
The Secrets Store CSI Driver Operator is installed on the cluster.
You are using Workload Identity Federation with a supported provider, such as AWS, Azure, Google Cloud Platform, or HashiCorp Vault.
You have configured your cloud provider to trust your OKD cluster’s OIDC provider.
You have access to the cluster with cluster-admin privileges.
Edit the ClusterCSIDriver custom resource for the Secrets Store CSI Driver Operator by running the following command:
$ oc edit clustercsidrivers.operator.openshift.io secrets-store.csi.k8s.io
Locate or add the tokenRequests section under spec.driverConfig.secretsStore. Set the type to Managed and configure the audience based on your cloud provider requirements:
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
tokenRequests:
type: Managed
managed:
audiences:
- audience: "api://AzureADTokenExchange"
expirationSeconds: 3600
where:
spec.driverConfig.secretsStore.tokenRequests.managed.audiences[].audienceSpecifies the audience value required by your cloud provider or secret management system. The audience must match the value configured in the trust policy of your cloud provider. For more information regarding audience value associated with different cloud providers, see corresponding cloud provider documentation.
spec.driverConfig.secretsStore.tokenRequests.managed.audiences[].expirationSecondsSpecifies the token validity duration in seconds. This parameter is optional. Valid range is 600 to 315,360,000 seconds. If omitted, the platform applies a default value.
For environments that require multiple audiences, you can specify multiple audience entries:
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
tokenRequests:
type: Managed
managed:
audiences:
- audience: "sts.amazonaws.com"
expirationSeconds: 3600
- audience: "api://AzureADTokenExchange"
expirationSeconds: 3600
Save and apply the changes to the custom resource.
Verify that the Secrets Store CSI Driver Operator driver pods have been updated with the token request configuration by running the following command:
$ oc get pods -n openshift-cluster-csi-drivers | grep secrets-store
secrets-store-csi-driver-node-bhp2d 3/3 Running 0 45s
secrets-store-csi-driver-node-xyz12 3/3 Running 0 45s
secrets-store-csi-driver-operator-74696fc7bc-qjrl8 1/1 Running 0 7m40s
Check the ClusterCSIDriver configuration to confirm the token request settings by running the following command:
$ oc get clustercsidrivers.operator.openshift.io secrets-store.csi.k8s.io -o jsonpath='{.spec.driverConfig.secretsStore.tokenRequests}' | jq
{
"managed": {
"audiences": [
{
"audience": "api://AzureADTokenExchange",
"expirationSeconds": 3600
}
]
},
"type": "Managed"
}
Create a test pod that mounts secrets from your external secret store to verify that Workload Identity Federation authentication works correctly by running the following command:
$ oc apply -f <test_pod_yaml>
Check the pod logs to confirm successful authentication and secret mounting by running the following command:
$ oc logs <test_pod_name>
Successful authentication indicates that the service account token with the specified audience is being accepted by your cloud provider’s identity federation system.
You can configure Workload Identity Federation for the Secrets Store CSI Driver Operator by setting parameters in the tokenRequests section under spec.driverConfig.secretsStore of the ClusterCSIDriver custom resource. It enables credential-free authentication to cloud provider secret stores.
The following table describes the parameters available for configuring service account token requests:
| Parameter | Type | Description |
|---|---|---|
|
String |
Specifies the token request management mode. Set to |
|
Array of objects |
Configures the service account token projection for Workload Identity Federation. Each entry specifies an audience and optional expiration. The Secrets Store CSI Driver Operator uses these tokens to authenticate to external secret management systems without storing long-lived credentials. This field is required when |
|
String |
Specifies the intended audience claim ( |
|
Integer |
Specifies the token validity duration in seconds. Valid range is 600 to 315,360,000 seconds. If omitted, the platform applies a default value. |
Different cloud providers and secret management systems require specific audience values. For more information on audience values, see corresponding cloud provider documentation.
The following examples demonstrate different token request configurations for various cloud providers:
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
tokenRequests:
type: Managed
managed:
audiences:
- audience: "api://AzureADTokenExchange"
expirationSeconds: 3600
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
tokenRequests:
type: Managed
managed:
audiences:
- audience: "sts.amazonaws.com"
expirationSeconds: 3600
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
tokenRequests:
type: Managed
managed:
audiences:
- audience: "vault.example.com"
apiVersion: operator.openshift.io/v1
kind: ClusterCSIDriver
metadata:
name: secrets-store.csi.k8s.io
spec:
driverConfig:
driverType: SecretsStore
secretsStore:
tokenRequests:
type: Managed
managed:
audiences:
- audience: "sts.amazonaws.com"
expirationSeconds: 3600
- audience: "api://AzureADTokenExchange"
expirationSeconds: 3600
When configuring token request parameters, consider the following:
The audience value must exactly match the value configured in your cloud provider’s trust policy or identity federation configuration.
Token requests enable the Secrets Store CSI Driver Operator to obtain projected service account tokens with the specified audience claim.
Different workloads can use different service accounts, allowing fine-grained access control through cloud provider IAM policies.
Workload Identity Federation eliminates the need to store cloud provider credentials in OKD, improving security.
You must configure your cloud provider to trust your OKD cluster’s OIDC provider before using Workload Identity Federation.
Multiple audience values can be specified to support multi-cloud or hybrid deployments where different external secret stores require different audiences.
To remove the Secrets Store CSI Driver Operator and free cluster resources, uninstall the Operator after stopping applications and removing the CSI driver.
Access to the OKD web console.
Administrator access to the cluster.
Stop all application pods that use the secrets-store.csi.k8s.io provider.
Remove any third-party provider plug-in for your chosen secret store.
Remove the Container Storage Interface (CSI) driver and associated manifests:
Click Administration → CustomResourceDefinitions → ClusterCSIDriver.
On the Instances tab, for secrets-store.csi.k8s.io, on the far left side, click the drop-down menu, and then click Delete ClusterCSIDriver.
When prompted, click Delete.
Verify that the CSI driver pods are no longer running.
Uninstall the Secrets Store CSI Driver Operator:
|
Before you can uninstall the Operator, you must remove the CSI driver first. |
Click Ecosystem → Installed Operators.
On the Installed Operators page, scroll or type "Secrets Store CSI" into the Search by name box to find the Operator, and then click it.
On the upper, right of the Installed Operators > Operator details page, click Actions → Uninstall Operator.
When prompted on the Uninstall Operator window, click the Uninstall button to remove the Operator from the namespace. Any applications deployed by the Operator on the cluster need to be cleaned up manually.
After uninstalling, the Secrets Store CSI Driver Operator is no longer listed in the Installed Operators section of the web console.