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
A persistent volume claim (PVC) uses the storage class object to dynamically provision an Azure file share. The following YAML can be used to create a persistent volume claim *5GB* in size with *ReadWriteMany* access. For more information on access modes, see the [Kubernetes persistent volume][access-modes] documentation.
106
+
A persistent volume claim (PVC) uses the storage class object to dynamically provision an Azure file share. The following YAML can be used to create a persistent volume claim *5 GB* in size with *ReadWriteMany* access. For more information on access modes, see the [Kubernetes persistent volume][access-modes] documentation.
103
107
104
108
Now create a file named `azure-file-pvc.yaml` and copy in the following YAML. Make sure that the *storageClassName* matches the storage class created in the last step:
105
109
@@ -117,6 +121,9 @@ spec:
117
121
storage: 5Gi
118
122
```
119
123
124
+
> [!NOTE]
125
+
> If using the *Premium_LRS* sku for your storage class, the minimum value for *storage* must be *100Gi*.
126
+
120
127
Create the persistent volume claim with the [kubectl apply][kubectl-apply] command:
121
128
122
129
```console
@@ -194,17 +201,7 @@ Volumes:
194
201
195
202
## Mount options
196
203
197
-
Default *fileMode* and *dirMode* values differ between Kubernetes versions as described in the following table.
198
-
199
-
| version | value |
200
-
| ---- | ---- |
201
-
| v1.6.x, v1.7.x | 0777 |
202
-
| v1.8.0-v1.8.5 | 0700 |
203
-
| v1.8.6 or above | 0755 |
204
-
| v1.9.0 | 0700 |
205
-
| v1.9.1 or above | 0755 |
206
-
207
-
If using a cluster of version 1.8.5 or greater and dynamically creating the persistent volume with a storage class, mount options can be specified on the storage class object. The following example sets *0777*:
204
+
The default value for *fileMode* and *dirMode* is *0755* for Kubernetes version 1.9.1 and above. If using a cluster with Kuberetes version 1.8.5 or greater and dynamically creating the persistent volume with a storage class, mount options can be specified on the storage class object. The following example sets *0777*:
Copy file name to clipboardExpand all lines: articles/aks/azure-files-volume.md
+71-10Lines changed: 71 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,17 +134,35 @@ Volumes:
134
134
135
135
## Mount options
136
136
137
-
Default *fileMode* and *dirMode* values differ between Kubernetes versions as described in the following table.
137
+
The default value for *fileMode* and *dirMode* is *0755* for Kubernetes version 1.9.1 and above. If using a cluster with Kuberetes version 1.8.5 or greater and statically creating the persistent volume object, mount options need to be specified on the *PersistentVolume* object. The following example sets *0777*:
138
138
139
-
| version | value |
140
-
| ---- | ---- |
141
-
| v1.6.x, v1.7.x | 0777 |
142
-
| v1.8.0-v1.8.5 | 0700 |
143
-
| v1.8.6 or above | 0755 |
144
-
| v1.9.0 | 0700 |
145
-
| v1.9.1 or above | 0755 |
139
+
```yaml
140
+
apiVersion: v1
141
+
kind: PersistentVolume
142
+
metadata:
143
+
name: azurefile
144
+
spec:
145
+
capacity:
146
+
storage: 5Gi
147
+
accessModes:
148
+
- ReadWriteMany
149
+
storageClassName: azurefile
150
+
azureFile:
151
+
secretName: azure-secret
152
+
shareName: aksshare
153
+
readOnly: false
154
+
mountOptions:
155
+
- dir_mode=0777
156
+
- file_mode=0777
157
+
- uid=1000
158
+
- gid=1000
159
+
- mfsymlinks
160
+
- nobrl
161
+
```
162
+
163
+
If using a cluster of version 1.8.0 - 1.8.4, a security context can be specified with the *runAsUser* value set to *0*. For more information on Pod security context, see [Configure a Security Context][kubernetes-security-context].
146
164
147
-
If using a cluster of version 1.8.5 or greater and statically creating the persistent volume object, mountoptions need to be specified on the *PersistentVolume* object.
165
+
To update your mount options, create a *azurefile-mount-options-pv.yaml* file with a *PersistentVolume*. For example:
148
166
149
167
```yaml
150
168
apiVersion: v1
@@ -156,6 +174,7 @@ spec:
156
174
storage: 5Gi
157
175
accessModes:
158
176
- ReadWriteMany
177
+
storageClassName: azurefile
159
178
azureFile:
160
179
secretName: azure-secret
161
180
shareName: aksshare
@@ -165,9 +184,51 @@ spec:
165
184
- file_mode=0777
166
185
- uid=1000
167
186
- gid=1000
187
+
- mfsymlinks
188
+
- nobrl
168
189
```
169
190
170
-
If using a cluster of version 1.8.0 - 1.8.4, a security context can be specified with the *runAsUser* value set to *0*. For more information on Pod security context, see [Configure a Security Context][kubernetes-security-context].
191
+
Create a *azurefile-mount-options-pvc.yaml* file with a *PersistentVolumeClaim* that uses the *PersistentVolume*. For example:
192
+
193
+
```yaml
194
+
apiVersion: v1
195
+
kind: PersistentVolumeClaim
196
+
metadata:
197
+
name: azurefile
198
+
spec:
199
+
accessModes:
200
+
- ReadWriteMany
201
+
storageClassName: azurefile
202
+
resources:
203
+
requests:
204
+
storage: 5Gi
205
+
```
206
+
207
+
Use the `kubectl` commands to create the *PersistentVolume* and *PersistentVolumeClaim*.
208
+
209
+
```console
210
+
kubectl apply -f azurefile-mount-options-pv.yaml
211
+
kubectl apply -f azurefile-mount-options-pvc.yaml
212
+
```
213
+
214
+
Verify your *PersistentVolumeClaim* is created and bound to the *PersistentVolume*.
215
+
216
+
```console
217
+
$ kubectl get pvc azurefile
218
+
219
+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
220
+
azurefile Bound azurefile 5Gi RWX azurefile 5s
221
+
```
222
+
223
+
Update your container spec to reference your *PersistentVolumeClaim* and update your pod. For example:
0 commit comments