Skip to content

Commit a86c24b

Browse files
committed
add dynamic provisioning
1 parent 33d74f3 commit a86c24b

File tree

2 files changed

+74
-3
lines changed

2 files changed

+74
-3
lines changed

deploy/example/mountstorage/README.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can also use a different managed-identity for different persistent volumes (
2323
az storage container create -n mycontainer --account-name "$storageaccountname" --public-access off
2424
```
2525

26-
## option#1: grant kubelet identity access to storage account
26+
## Option#1: grant kubelet identity access to storage account
2727

2828
1. Give kubelet identity access to storage account
2929
```bash
@@ -38,7 +38,7 @@ You can also use a different managed-identity for different persistent volumes (
3838
az identity list -g "$resourcegroup" --query "[?name == 'aks-fuseblob-mi-agentpool'].clientId" -o tsv
3939
```
4040

41-
## option#2: grant a dedicated user-assigned managed identity access to storage account
41+
## Option#2: grant a dedicated user-assigned managed identity access to storage account
4242
You can use a dedicated user-assigned managed identity to mount the storage.
4343

4444
1. Create user-assigned managed identity and give access to storage account
@@ -154,12 +154,56 @@ You can use a dedicated user-assigned managed identity to mount the storage.
154154
kubectl get pv
155155
kubectl get pvc
156156
157-
# create deployment and service
157+
# create deployment
158158
kubectl apply -f deployment.yaml
159159
# check pod
160160
kubectl get pods
161161
```
162162

163+
# dynamic provisioning in an existing resource group
164+
165+
1. Grant cluster system assigned identity `Contributor` to resource group, if mount in an existing storage account, then should also grant identity to storage account
166+
167+
1. Grant kubelet identity `Storage Blob Data Owner` to resource group to mount blob storage, if mount in an existing storage account, then should also grant identity to storage account
168+
169+
1. Create a storage class and give an existing resource group, CSI will create a new storage account when `storageAccount` is not provided.
170+
```yml
171+
apiVersion: storage.k8s.io/v1
172+
kind: StorageClass
173+
metadata:
174+
name: blob-fuse
175+
provisioner: blob.csi.azure.com
176+
parameters:
177+
skuName: Premium_LRS
178+
protocol: fuse
179+
resourceGroup: EXISTING_RESOURCE_GROUP_NAME
180+
storageAccount: EXISTING_STORAGE_ACCOUNT_NAME # optional, if use existing storage account
181+
containerName: EXISTING_CONTAINER_NAME # optional, if use existing container
182+
AzureStorageAuthType: MSI
183+
AzureStorageIdentityClientID: "92926dfd-e61b-4730-85ab-5be73b374e82"
184+
reclaimPolicy: Delete
185+
volumeBindingMode: Immediate
186+
allowVolumeExpansion: true
187+
mountOptions:
188+
- -o allow_other
189+
- --file-cache-timeout-in-seconds=120
190+
- --use-attr-cache=true
191+
- --cancel-list-on-mount-seconds=10 # prevent billing charges on mounting
192+
- -o attr_timeout=120
193+
- -o entry_timeout=120
194+
- -o negative_timeout=120
195+
- --log-level=LOG_WARNING # LOG_WARNING, LOG_INFO, LOG_DEBUG
196+
- --cache-size-mb=1000 # Default will be 80% of available memory, eviction will happen beyond that.
197+
```
198+
199+
1. Using dynamic provisioning
200+
```console
201+
# create pvc and deployment
202+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/deployment.yaml
203+
# check pod
204+
kubectl get pods
205+
```
206+
163207
# how to add another pv with a dedicated user-assigned identity?
164208

165209
1. Create another user-assigned managed identity and give access to storage account
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
apiVersion: storage.k8s.io/v1
3+
kind: StorageClass
4+
metadata:
5+
name: blob-fuse
6+
provisioner: blob.csi.azure.com
7+
parameters:
8+
skuName: Premium_LRS
9+
protocol: fuse
10+
resourceGroup: EXISTING_RESOURCE_GROUP_NAME
11+
storageAccount: EXISTING_STORAGE_ACCOUNT_NAME # optional, if use existing storage account
12+
containerName: EXISTING_CONTAINER_NAME # optional, if use existing container
13+
AzureStorageAuthType: MSI
14+
AzureStorageIdentityClientID: "92926dfd-e61b-4730-85ab-5be73b374e82"
15+
reclaimPolicy: Delete
16+
volumeBindingMode: Immediate
17+
allowVolumeExpansion: true
18+
mountOptions:
19+
- -o allow_other
20+
- --file-cache-timeout-in-seconds=120
21+
- --use-attr-cache=true
22+
- --cancel-list-on-mount-seconds=10 # prevent billing charges on mounting
23+
- -o attr_timeout=120
24+
- -o entry_timeout=120
25+
- -o negative_timeout=120
26+
- --log-level=LOG_WARNING # LOG_WARNING, LOG_INFO, LOG_DEBUG
27+
- --cache-size-mb=1000 # Default will be 80% of available memory, eviction will happen beyond that.

0 commit comments

Comments
 (0)