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
[Azure Container Storage](container-storage-introduction.md) is a cloud-based volume management, deployment, and orchestration service built natively for containers. This article shows you how to configure Azure Container Storage to use Ephemeral Disk as back-end storage for your Kubernetes workloads. At the end, you'll have a pod that's using either local NVMe or temp SSD as its storage.
15
15
16
16
> [!IMPORTANT]
17
-
> Local disks are ephemeral, meaning that they're created on the local virtual machine (VM) storage and not saved to an Azure storage service. Data will be lost on these disks if you stop/deallocate your VM.
17
+
> Local disks are ephemeral, meaning that they're created on the local virtual machine (VM) storage and not saved to an Azure storage service. Data will be lost on these disks if you stop/deallocate your VM. You can only create [Kubernetes generic ephemeral volumes](https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes) from an Ephemeral Disk storage pool. If you want to create a persistent volume, you have to enable [replication for your storage pool](#optional-create-storage-pool-with-volume-replication-nvme-only).
18
18
19
19
## Prerequisites
20
20
@@ -129,78 +129,14 @@ Run `kubectl get sc` to display the available storage classes. You should see a
129
129
> [!IMPORTANT]
130
130
> Don't use the storage class that's marked **internal**. It's an internal storage class that's needed for Azure Container Storage to work.
131
131
132
-
## Create a persistent volume claim
133
-
134
-
A persistent volume claim (PVC) is used to automatically provision storage based on a storage class. Follow these steps to create a PVC using the new storage class.
132
+
## Deploy a pod with a generic ephemeral volume
135
133
136
-
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-pvc.yaml`.
137
-
138
-
1. Paste in the following code and save the file. The PVC `name` value can be whatever you want.
139
-
140
-
```yml
141
-
apiVersion: v1
142
-
kind: PersistentVolumeClaim
143
-
metadata:
144
-
name: ephemeralpvc
145
-
spec:
146
-
accessModes:
147
-
- ReadWriteOnce
148
-
storageClassName: acstor-ephemeraldisk # replace with the name of your storage class if different
149
-
resources:
150
-
requests:
151
-
storage: 100Gi
152
-
```
153
-
154
-
1. Apply the YAML manifest file to create the PVC.
155
-
156
-
```azurecli-interactive
157
-
kubectl apply -f acstor-pvc.yaml
158
-
```
159
-
160
-
You should see output similar to:
161
-
162
-
```output
163
-
persistentvolumeclaim/ephemeralpvc created
164
-
```
165
-
166
-
You can verify the status of the PVC by running the following command:
167
-
168
-
```azurecli-interactive
169
-
kubectl describe pvc ephemeralpvc
170
-
```
171
-
172
-
Once the PVC is created, it's ready for use by a pod.
173
-
174
-
## Deploy a pod and attach a persistent volume
175
-
176
-
Create a pod using [Fio](https://github.com/axboe/fio) (Flexible I/O Tester) for benchmarking and workload simulation, and specify a mount path for the persistent volume. For **claimName**, use the **name** value that you used when creating the persistent volume claim.
134
+
Create a pod using [Fio](https://github.com/axboe/fio) (Flexible I/O Tester) for benchmarking and workload simulation, that uses a generic ephemeral volume.
177
135
178
136
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-pod.yaml`.
179
137
180
138
1. Paste in the following code and save the file.
181
139
182
-
```yml
183
-
kind: Pod
184
-
apiVersion: v1
185
-
metadata:
186
-
name: fiopod
187
-
spec:
188
-
nodeSelector:
189
-
acstor.azure.com/io-engine: acstor
190
-
volumes:
191
-
- name: ephemeralpv
192
-
persistentVolumeClaim:
193
-
claimName: ephemeralpvc
194
-
containers:
195
-
- name: fio
196
-
image: nixery.dev/shell/fio
197
-
args:
198
-
- sleep
199
-
- "1000000"
200
-
volumeMounts:
201
-
- mountPath: "/volume"
202
-
name: ephemeralpv
203
-
```
204
140
205
141
1. Apply the YAML manifest file to deploy the pod.
206
142
@@ -214,11 +150,11 @@ Create a pod using [Fio](https://github.com/axboe/fio) (Flexible I/O Tester) for
214
150
pod/fiopod created
215
151
```
216
152
217
-
1. Check that the pod is running and that the persistent volume claim has been bound successfully to the pod:
153
+
1. Check that the pod is running and that the ephemeral volume claim has been bound successfully to the pod:
218
154
219
155
```azurecli-interactive
220
156
kubectl describe pod fiopod
221
-
kubectl describe pvc ephemeralpvc
157
+
kubectl describe pvc fiopod-ephemeralvolume
222
158
```
223
159
224
160
1. Check fio testing to see its current status:
@@ -275,6 +211,7 @@ Follow these steps to create a storage pool using local NVMe with replication.
275
211
276
212
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-storagepool.yaml`.
277
213
214
+
278
215
1. Paste in the following code and save the file. The storage pool **name** value can be whatever you want. Set replicas to 3 or 5.
279
216
280
217
```yml
@@ -308,7 +245,119 @@ Follow these steps to create a storage pool using local NVMe with replication.
308
245
kubectl describe sp <storage-pool-name> -n acstor
309
246
```
310
247
311
-
When the storage pool is created, Azure Container Storage will create a storage class on your behalf, using the naming convention `acstor-<storage-pool-name>`. Now you can [display the available storage classes](#display-the-available-storage-classes) and [create a persistent volume claim](#create-a-persistent-volume-claim).
248
+
When the storage pool is created, Azure Container Storage will create a storage class on your behalf, using the naming convention `acstor-<storage-pool-name>`. Now you can [display the available storage classes](#display-the-available-storage-classes) and create a persistent volume claim.
249
+
250
+
## Create a persistent volume claim
251
+
252
+
A persistent volume claim (PVC) is used to automatically provision storage based on a storage class. Follow these steps to create a PVC using the new storage class.
253
+
254
+
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-pvc.yaml`.
255
+
256
+
1. Paste in the following code and save the file. The PVC `name` value can be whatever you want.
257
+
258
+
```yml
259
+
apiVersion: v1
260
+
kind: PersistentVolumeClaim
261
+
metadata:
262
+
name: ephemeralpvc
263
+
spec:
264
+
accessModes:
265
+
- ReadWriteOnce
266
+
storageClassName: acstor-ephemeraldisk-nvme # replace with the name of your storage class if different
267
+
resources:
268
+
requests:
269
+
storage: 100Gi
270
+
```
271
+
272
+
1. Apply the YAML manifest file to create the PVC.
273
+
274
+
```azurecli-interactive
275
+
kubectl apply -f acstor-pvc.yaml
276
+
```
277
+
278
+
You should see output similar to:
279
+
280
+
```output
281
+
persistentvolumeclaim/ephemeralpvc created
282
+
```
283
+
284
+
You can verify the status of the PVC by running the following command:
285
+
286
+
```azurecli-interactive
287
+
kubectl describe pvc ephemeralpvc
288
+
```
289
+
290
+
Once the PVC is created, it's ready for use by a pod.
291
+
292
+
## Deploy a pod and attach a persistent volume
293
+
294
+
Create a pod using [Fio](https://github.com/axboe/fio) (Flexible I/O Tester) for benchmarking and workload simulation, and specify a mount path for the persistent volume. For **claimName**, use the **name** value that you used when creating the persistent volume claim.
295
+
296
+
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-pod.yaml`.
297
+
298
+
1. Paste in the following code and save the file.
299
+
300
+
```yml
301
+
kind: Pod
302
+
apiVersion: v1
303
+
metadata:
304
+
name: fiopod
305
+
spec:
306
+
nodeSelector:
307
+
acstor.azure.com/io-engine: acstor
308
+
volumes:
309
+
- name: ephemeralpv
310
+
persistentVolumeClaim:
311
+
claimName: ephemeralpvc
312
+
containers:
313
+
- name: fio
314
+
image: nixery.dev/shell/fio
315
+
args:
316
+
- sleep
317
+
- "1000000"
318
+
volumeMounts:
319
+
- mountPath: "/volume"
320
+
name: ephemeralpv
321
+
```
322
+
323
+
1. Apply the YAML manifest file to deploy the pod.
324
+
325
+
```azurecli-interactive
326
+
kubectl apply -f acstor-pod.yaml
327
+
```
328
+
329
+
You should see output similar to the following:
330
+
331
+
```output
332
+
pod/fiopod created
333
+
```
334
+
335
+
1. Check that the pod is running and that the persistent volume claim has been bound successfully to the pod:
You've now deployed a pod that's using Ephemeral Disk as its storage, and you can use it for your Kubernetes workloads.
349
+
350
+
## Detach and reattach a persistent volume
351
+
352
+
To detach a persistent volume, delete the pod that the persistent volume is attached to. Replace `<pod-name>` with the name of the pod, for example **fiopod**.
353
+
354
+
```azurecli-interactive
355
+
kubectl delete pods <pod-name>
356
+
```
357
+
358
+
To reattach a persistent volume, simply reference the persistent volume claim name in the YAML manifest file as described in [Deploy a pod and attach a persistent volume](#deploy-a-pod-and-attach-a-persistent-volume).
359
+
360
+
To check which persistent volume a persistent volume claim is bound to, run `kubectl get pvc <persistent-volume-claim-name>`.
0 commit comments