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
## option#1: dynamic provisoning with storage class
69
+
```
70
+
cat <<EOF | kubectl apply -f -
71
+
apiVersion: storage.k8s.io/v1
72
+
kind: StorageClass
73
+
metadata:
74
+
name: blob-fuse
75
+
provisioner: blob.csi.azure.com
76
+
parameters:
77
+
storageaccount: $ACCOUNT # required
78
+
clientID: $USER_ASSIGNED_CLIENT_ID # required, $USER_ASSIGNED_CLIENT_ID is only for mount auth, make sure you CSI driver controller pod has `Contributor` role on the specified account
79
+
resourcegroup: $STORAGE_RESOURCE_GROUP # optional, specified when the storage account is not under AKS node resource group(which is prefixed with "MC_")
80
+
reclaimPolicy: Delete
81
+
volumeBindingMode: Immediate
82
+
allowVolumeExpansion: true
83
+
mountOptions:
84
+
- -o allow_other
85
+
- --file-cache-timeout-in-seconds=120
86
+
- --use-attr-cache=true
87
+
- --cancel-list-on-mount-seconds=10 # prevent billing charges on mounting
- set -euo pipefail; while true; do echo $(date) >> /mnt/blob/outfile; sleep 1; done
119
+
volumeMounts:
120
+
- name: persistent-storage
121
+
mountPath: /mnt/blob
122
+
readOnly: false
123
+
updateStrategy:
124
+
type: RollingUpdate
125
+
selector:
126
+
matchLabels:
127
+
app: nginx
128
+
volumeClaimTemplates:
129
+
- metadata:
130
+
name: persistent-storage
131
+
spec:
132
+
storageClassName: blob-fuse
133
+
accessModes: ["ReadWriteMany"]
134
+
resources:
135
+
requests:
136
+
storage: 100Gi
137
+
EOF
138
+
```
68
139
69
-
## option#1: static provision with PV
140
+
## option#2: static provision with PV
70
141
```
71
142
cat <<EOF | kubectl apply -f -
72
143
apiVersion: v1
@@ -94,13 +165,12 @@ spec:
94
165
containerName: $CONTAINER # required
95
166
clientID: $USER_ASSIGNED_CLIENT_ID # required
96
167
resourcegroup: $STORAGE_RESOURCE_GROUP # optional, specified when the storage account is not under AKS node resource group(which is prefixed with "MC_")
97
-
# tenantID: $IDENTITY_TENANT #optional, only specified when workload identity and AKS cluster are in different tenant
98
-
# subscriptionid: $SUBSCRIPTION #optional, only specified when workload identity and AKS cluster are in different subscription
99
168
---
100
169
kind: PersistentVolumeClaim
101
170
apiVersion: v1
102
171
metadata:
103
172
name: pvc-blob
173
+
namespace: ${SERVICE_ACCOUNT_NAMESPACE}
104
174
spec:
105
175
accessModes:
106
176
- ReadWriteMany
@@ -116,6 +186,7 @@ metadata:
116
186
labels:
117
187
app: nginx
118
188
name: deployment-blob
189
+
namespace: ${SERVICE_ACCOUNT_NAMESPACE}
119
190
spec:
120
191
replicas: 1
121
192
selector:
@@ -127,7 +198,7 @@ spec:
127
198
app: nginx
128
199
name: deployment-blob
129
200
spec:
130
-
serviceAccountName: $SERVICE_ACCOUNT_NAME #required, Pod has no permission to mount the volume without this field
201
+
serviceAccountName: $SERVICE_ACCOUNT_NAME #required, Pod lacks the necessary permission to mount the volume without this field
131
202
nodeSelector:
132
203
"kubernetes.io/os": linux
133
204
containers:
@@ -152,39 +223,3 @@ spec:
152
223
type: RollingUpdate
153
224
EOF
154
225
```
155
-
156
-
## option#2: Pod with ephemeral inline volume
157
-
```
158
-
cat <<EOF | kubectl apply -f -
159
-
kind: Pod
160
-
apiVersion: v1
161
-
metadata:
162
-
name: nginx-blobfuse-inline-volume
163
-
spec:
164
-
serviceAccountName: $SERVICE_ACCOUNT_NAME #required, Pod does not use this service account has no permission to mount the volume
165
-
nodeSelector:
166
-
"kubernetes.io/os": linux
167
-
containers:
168
-
- image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
169
-
name: nginx-blobfuse
170
-
command:
171
-
- "/bin/bash"
172
-
- "-c"
173
-
- set -euo pipefail; while true; do echo $(date) >> /mnt/blobfuse/outfile; sleep 1; done
174
-
volumeMounts:
175
-
- name: persistent-storage
176
-
mountPath: "/mnt/blobfuse"
177
-
readOnly: false
178
-
volumes:
179
-
- name: persistent-storage
180
-
csi:
181
-
driver: blob.csi.azure.com
182
-
volumeAttributes:
183
-
storageaccount: $ACCOUNT # required
184
-
containerName: $CONTAINER # required
185
-
clientID: $USER_ASSIGNED_CLIENT_ID # required
186
-
resourcegroup: $STORAGE_RESOURCE_GROUP # optional, specified when the storage account is not under AKS node resource group(which is prefixed with "MC_")
187
-
# tenantID: $IDENTITY_TENANT # optional, only specified when workload identity and AKS cluster are in different tenant
188
-
# subscriptionid: $SUBSCRIPTION # optional, only specified when workload identity and AKS cluster are in different subscription
0 commit comments