You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Install the Secrets Store CSI Driver](#install-the-secrets-store-csi-driver)
42
-
-[Use the Secrets Store CSI Driver with a Provider](#use-the-secrets-store-csi-driver-with-a-provider)
43
-
-[Create your own SecretProviderClass Object](#create-your-own-secretproviderclass-object)
44
-
-[Update your Deployment Yaml](#update-your-deployment-yaml)
45
-
-[Secret Content is Mounted on Pod Start](#secret-content-is-mounted-on-pod-start)
46
-
-[[OPTIONAL] Sync with Kubernetes Secrets](#optional-sync-with-kubernetes-secrets)
47
-
-[[OPTIONAL] Set ENV VAR](#optional-set-env-var)
48
-
-[[OPTIONAL] Enable Auto Rotation of Secrets](#optional-enable-auto-rotation-of-secrets)
49
-
-[Providers](#providers)
50
-
-[Criteria for Supported Providers](#criteria-for-supported-providers)
51
-
-[Removal from Supported Providers](#removal-from-supported-providers)
52
-
-[Testing](#testing)
53
-
-[Unit Tests](#unit-tests)
54
-
-[End-to-end Tests](#end-to-end-tests)
55
-
-[Known Limitations](#known-limitations)
56
-
-[Troubleshooting](#troubleshooting)
57
-
-[Code of conduct](#code-of-conduct)
58
-
59
-
## How It Works
60
-
61
-
The diagram below illustrates how Secrets Store CSI Volume works.
62
-
63
-

29
+
- Supports multiple secrets stores providers in the same cluster.
64
30
65
31
## Demo
66
32
67
-

68
-
69
-
## Usage
70
-
71
-
### Prerequisites
72
-
73
-
#### Supported kubernetes versions
74
-
75
-
Recommended Kubernetes version: v1.16.0+
76
-
77
-
> NOTE: The CSI Inline Volume feature was introduced in Kubernetes v1.15.x. Version 1.15.x will require the `CSIInlineVolume` feature gate to be updated in the cluster. Version 1.16+ does not require any feature gate.
78
-
79
-
<details>
80
-
<summary><strong> For v1.15.x, update CSI Inline Volume feature gate </strong></summary>
81
-
82
-
The CSI Inline Volume feature was introduced in Kubernetes v1.15.x. We need to make the following updates to include the `CSIInlineVolume` feature gate:
83
-
84
-
- Update the API Server manifest to append the following feature gate:
85
-
86
-
```yaml
87
-
--feature-gates=CSIInlineVolume=true
88
-
```
89
-
90
-
- Update Kubelet manifest on each node to append the `CSIInlineVolume` feature gate:
91
-
92
-
```yaml
93
-
--feature-gates=CSIInlineVolume=true
94
-
```
95
-
</details>
96
-
97
-
### Install the Secrets Store CSI Driver
98
-
99
-
**Using Helm Chart**
100
-
101
-
Follow the [guide to install driver using Helm](charts/secrets-store-csi-driver/README.md)
102
-
103
-
104
-
<details>
105
-
<summary><strong>[ALTERNATIVE DEPLOYMENT OPTION] Using Deployment Yamls</strong></summary>
106
-
107
-
```bash
108
-
kubectl apply -f deploy/rbac-secretproviderclass.yaml # update the namespace of the secrets-store-csi-driver ServiceAccount
To use the Secrets Store CSI driver, create a `SecretProviderClass` custom resource to provide driver configurations and provider-specific parameters to the CSI driver.
170
-
171
-
A `SecretProviderClass` custom resource should have the following components:
172
-
```yaml
173
-
apiVersion: secrets-store.csi.x-k8s.io/v1alpha1
174
-
kind: SecretProviderClass
175
-
metadata:
176
-
name: my-provider
177
-
spec:
178
-
provider: vault # accepted provider options: azure or vault or gcp
179
-
parameters: # provider-specific parameters
180
-
```
181
-
182
-
Here is a sample [`SecretProviderClass` custom resource](test/bats/tests/vault/vault_v1alpha1_secretproviderclass.yaml)
183
-
184
-
### Update your Deployment Yaml
185
-
186
-
To ensure your application is using the Secrets Store CSI driver, update your deployment yaml to use the `secrets-store.csi.k8s.io` driver and reference the `SecretProviderClass` resource created in the previous step.
187
-
188
-
```yaml
189
-
volumes:
190
-
- name: secrets-store-inline
191
-
csi:
192
-
driver: secrets-store.csi.k8s.io
193
-
readOnly: true
194
-
volumeAttributes:
195
-
secretProviderClass: "my-provider"
196
-
```
197
-
198
-
Here is a sample [deployment yaml](test/bats/tests/vault/nginx-pod-vault-inline-volume-secretproviderclass.yaml) using the Secrets Store CSI driver.
199
-
200
-
### Secret Content is Mounted on Pod Start
201
-
202
-
On pod start and restart, the driver will communicate with the provider using gRPC to retrieve the secret content from the external Secrets Store you have specified in the `SecretProviderClass` custom resource. Then the volume is mounted in the pod as `tmpfs` and the secret contents are written to the volume.
203
-
204
-
To validate, once the pod is started, you should see the new mounted content at the volume path specified in your deployment yaml.
205
-
206
-
```bash
207
-
kubectl exec -it nginx-secrets-store-inline ls /mnt/secrets-store/
208
-
foo
209
-
```
210
-
211
-
### [OPTIONAL] Sync with Kubernetes Secrets
212
-
213
-
In some cases, you may want to create a Kubernetes Secret to mirror the mounted content. Use the optional `secretObjects` field to define the desired state of the synced Kubernetes secret objects. **The volume mount is required for the Sync With Kubernetes Secrets**
214
-
> NOTE: If the provider supports object alias for the mounted file, then make sure the `objectName` in `secretObjects` matches the name of the mounted content. This could be the object name or the object alias.
215
-
216
-
A `SecretProviderClass` custom resource should have the following components:
217
-
```yaml
218
-
apiVersion: secrets-store.csi.x-k8s.io/v1alpha1
219
-
kind: SecretProviderClass
220
-
metadata:
221
-
name: my-provider
222
-
spec:
223
-
provider: vault # accepted provider options: azure or vault or gcp
224
-
secretObjects: # [OPTIONAL] SecretObject defines the desired state of synced K8s secret objects
225
-
- data:
226
-
- key: username # data field to populate
227
-
objectName: foo1 # name of the mounted content to sync. this could be the object name or the object alias
228
-
secretName: foosecret # name of the Kubernetes Secret object
229
-
type: Opaque # type of the Kubernetes Secret object e.g. Opaque, kubernetes.io/tls
230
-
```
231
-
> NOTE: Here is the list of supported Kubernetes Secret types: `Opaque`, `kubernetes.io/basic-auth`, `bootstrap.kubernetes.io/token`, `kubernetes.io/dockerconfigjson`, `kubernetes.io/dockercfg`, `kubernetes.io/ssh-auth`, `kubernetes.io/service-account-token`, `kubernetes.io/tls`.
232
-
233
-
Here is a sample [`SecretProviderClass` custom resource](test/bats/tests/vault/vault_synck8s_v1alpha1_secretproviderclass.yaml) that syncs Kubernetes secrets.
234
-
235
-
### [OPTIONAL] Set ENV VAR
236
-
237
-
Once the secret is created, you may wish to set an ENV VAR in your deployment to reference the new Kubernetes secret.
238
-
239
-
```yaml
240
-
spec:
241
-
containers:
242
-
- image: nginx
243
-
name: nginx
244
-
env:
245
-
- name: SECRET_USERNAME
246
-
valueFrom:
247
-
secretKeyRef:
248
-
name: foosecret
249
-
key: username
250
-
```
251
-
Here is a sample [deployment yaml](test/bats/tests/vault/nginx-deployment-synck8s.yaml) that creates an ENV VAR from the synced Kubernetes secret.
252
-
253
-
### [OPTIONAL] Enable Auto Rotation of Secrets
254
-
255
-
You can setup the Secrets Store CSI Driver to periodically update the pod mount and Kubernetes Secret with the latest content from external secrets-store. Refer to [doc](docs/README.rotation.md) for steps on enabling auto rotation.
256
-
257
-
**NOTE** The CSI driver **does not restart** the application pods. It only handles updating the pod mount and Kubernetes secret similar to how Kubernetes handles updates to Kubernetes secret mounted as volumes.
258
-
259
-
260
-
## Providers
261
-
262
-
This project features a pluggable provider interface developers can implement that defines the actions of the Secrets Store CSI driver. This enables retrieval of sensitive objects stored in an enterprise-grade external secrets store into Kubernetes while continue to manage these objects outside of Kubernetes.
263
-
264
-
### Criteria for Supported Providers
265
-
266
-
Here is a list of criteria for supported provider:
267
-
1. Code audit of the provider implementation to ensure it adheres to the required provider-driver interface - [Implementing a Provider for Secrets Store CSI Driver](docs/README.new-provider.md)
268
-
2. Add provider to the e2e test suite to demonstrate it functions as expected https://github.com/kubernetes-sigs/secrets-store-csi-driver/tree/master/test/bats Please use existing providers e2e tests as a reference.
269
-
3. If any update is made by a provider (not limited to security updates), the provider is expected to update the provider's e2e test in this repo
270
-
271
-
### Removal from Supported Providers
272
-
273
-
Failure to adhere to the [Criteria for Supported Providers](#criteria-for-supported-providers) will result in the removal of the provider from the supported list and subject to another review before it can be added back to the list of supported providers.
274
-
275
-
When a provider's e2e tests are consistently failing with the latest version of the driver, the driver maintainers will coordinate with the provider maintainers to provide a fix. If the test failures are not resolved within 4 weeks, then the provider will be removed from the list of supported providers.
276
-
277
-
## Testing
278
-
279
-
### Unit Tests
280
-
281
-
Run unit tests locally with `make test`.
282
-
283
-
### End-to-end Tests
284
-
285
-
End-to-end tests automatically runs on Prow when a PR is submitted. If you want to run using a local or remote Kubernetes cluster, make sure to have `kubectl`, `helm` and `bats` set up in your local environment and then run `make e2e-azure` or `make e2e-vault` with custom images.
286
-
287
-
Job config for test jobs run for each PR in prow can be found [here](https://github.com/kubernetes/test-infra/blob/master/config/jobs/kubernetes-sigs/secrets-store-csi-driver/secrets-store-csi-driver-config.yaml)
288
-
289
-
## Known Limitations
33
+

290
34
291
-
- [Mounted content and Kubernetes Secret not updated after secret is updated in external secrets-store](docs/README.limitations.md#mounted-content-and-kubernetes-secret-not-updated-after-secret-is-updated-in-external-secrets-store)
35
+
## Getting Started
292
36
293
-
## Troubleshooting
37
+
Check out the [installation instructions](https://secrets-store-csi-driver.sigs.k8s.io/getting-started/installation.html) to deploy the Secrets Store CSI Driver and providers. Get familiar with our [CRDs and core components](https://secrets-store-csi-driver.sigs.k8s.io/concepts.html)
294
38
295
-
- To troubleshoot issues with the csi driver, you can look at logs from the `secrets-store` container of the csi driver pod running on the same node as your application pod:
296
-
```bash
297
-
kubectl get pod -o wide
298
-
# find the secrets store csi driver pod running on the same node as your application pod
0 commit comments