Skip to content

Commit 98afee8

Browse files
committed
docs: add the example of using key vault
Signed-off-by: ZeroMagic <[email protected]>
1 parent 4a2db31 commit 98afee8

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

deploy/example/keyvault/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Use Blobfuse CSI Driver with Azure Key Vault
2+
3+
> Attention: Currently, we just support use Key Vault in static provisioning scenario.
4+
5+
## Prepare Key Vault
6+
7+
1. Create a Key Vault in the [portal](https://ms.portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.KeyVault%2Fvaults).
8+
9+
2. Store `storage account key` or `SAS token` in Key Vault's Secret.
10+
11+
3. Ensure the service principal has all the required permissions to access content in your Azure key vault instance. If not, you can run the following using the Azure CLI:
12+
13+
```console
14+
# Assign Reader Role to the service principal for your keyvault
15+
az role assignment create --role Reader --assignee <aadClientId> --scope /subscriptions/<subscriptionid>/resourcegroups/<resourcegroup>/providers/Microsoft.KeyVault/vaults/<keyvaultname>
16+
17+
az keyvault set-policy -n $KV_NAME --key-permissions get --spn <YOUR SPN CLIENT ID>
18+
az keyvault set-policy -n $KV_NAME --secret-permissions get --spn <YOUR SPN CLIENT ID>
19+
az keyvault set-policy -n $KV_NAME --certificate-permissions get --spn <YOUR CLIENT ID>
20+
```
21+
22+
## Install Blobfuse CSI Driver
23+
24+
### Option #1
25+
26+
Use the [script](https://github.com/csi-driver/blobfuse-csi-driver/blob/master/deploy/install-driver.sh) to install.
27+
28+
### Option #2
29+
30+
Use [helm](https://github.com/csi-driver/blobfuse-csi-driver/blob/master/charts/README.md) to install.
31+
32+
## Create PVC
33+
34+
Use default pvc file to create.
35+
36+
```console
37+
kubectl apply -f pvc-blobfuse-csi-static-keyvault.yaml
38+
```
39+
40+
## Create PV
41+
42+
1. Replace your Key Vault infomation in the yaml.
43+
44+
`keyVaultURL` and `keyVaultSecretName` are the required parameters.
45+
46+
`keyVaultSecretVersion` is the optional parameter. If not specified, it will be *current versoin*.
47+
2. Create pv
48+
49+
```console
50+
kubectl apply -f pv-blobfuse-csi-static-keyvault.yaml
51+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: PersistentVolume
3+
metadata:
4+
name: pv-blobfuse-keyvault
5+
spec:
6+
capacity:
7+
storage: 10Gi
8+
accessModes:
9+
- ReadWriteMany
10+
persistentVolumeReclaimPolicy: Retain #If set as "Delete" container would be removed after pvc deletion
11+
csi:
12+
driver: blobfuse.csi.azure.com
13+
readOnly: false
14+
volumeHandle: arbitrary-volumeid
15+
volumeAttributes:
16+
containerName: EXISTING_CONTAINER_NAME
17+
storageAccountName: EXISTING_STORAGE_ACCOUNT_NAME
18+
keyVaultURL: xxx
19+
keyVaultSecretName: xxx
20+
keyVaultSecretVersion: xxx # use "current versoin" if empty
21+
nodePublishSecretRef:
22+
name: azure-secret
23+
namespace: default
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: PersistentVolumeClaim
2+
apiVersion: v1
3+
metadata:
4+
name: pvc-blobfuse-keyvault
5+
spec:
6+
accessModes:
7+
- ReadWriteMany
8+
resources:
9+
requests:
10+
storage: 10Gi
11+
volumeName: pv-blobfuse-keyvault
12+
storageClassName: ""

docs/driver-parameters.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ containerName | specify the existing container name where blob storage will be c
1616

1717
- Static Provisioning(use existing storage container)
1818
> get a quick example [here](../deploy/example/pv-blobfuse-csi.yaml)
19+
>
20+
> get a key vault example [here](../deploy/example/keyvault/pv-blobfuse-csi-keyvault.yaml)
1921
2022
Name | Meaning | Available Value | Mandatory | Default value
2123
--- | --- | --- | --- | ---
2224
volumeAttributes.containerName | existing container name | existing container name | Yes |
25+
volumeAttributes.storageAccountName | existing storage account name | existing storage account name | Yes |
26+
volumeAttributes.keyVaultURL | url of the key vault | the key vault which has been created | Yes |
27+
volumeAttributes.keyVaultSecretName | name of the secret in key vault | the secret which has been created | Yes |
28+
volumeAttributes.keyVaultSecretVersion | existing container name | existing container name | No |if empty, driver will use "current versoin"
2329
nodePublishSecretRef.name | secret name that stores storage account name and key | existing secret name | Yes |
2430
nodePublishSecretRef.namespace | namespace where the secret is | k8s namespace | No | `default`
31+

0 commit comments

Comments
 (0)