Skip to content

Commit 20c0e77

Browse files
committed
update disks flow
1 parent be5cc16 commit 20c0e77

File tree

1 file changed

+132
-120
lines changed

1 file changed

+132
-120
lines changed

articles/storage/container-storage/use-container-storage-with-managed-disks.md

Lines changed: 132 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Configure Azure Container Storage for use with Azure managed disks.
44
author: khdownie
55
ms.service: azure-container-storage
66
ms.topic: how-to
7-
ms.date: 03/12/2024
7+
ms.date: 06/19/2024
88
ms.author: kendownie
99
ms.custom: references_regions
1010
---
@@ -20,15 +20,25 @@ ms.custom: references_regions
2020
> [!NOTE]
2121
> To use Azure Container Storage with Azure managed disks, your AKS cluster should have a node pool of at least three [general purpose VMs](../../virtual-machines/sizes-general.md) such as **standard_d4s_v5** for the cluster nodes, each with a minimum of four virtual CPUs (vCPUs).
2222
23-
## Create a storage pool
23+
## Create and attach persistent volumes
24+
25+
Follow these steps to create and attach a persistent volume.
26+
27+
### 1. Create a storage pool
2428

2529
First, create a storage pool, which is a logical grouping of storage for your Kubernetes cluster, by defining it in a YAML manifest file.
2630

27-
If you enabled Azure Container Storage using `az aks create` or `az aks update` commands, you might already have a storage pool. Use `kubectl get sp -n acstor` to get the list of storage pools. If you have a storage pool already available that you want to use, you can skip this section and proceed to [Display the available storage classes](#display-the-available-storage-classes).
31+
You have the following options for creating a storage pool:
32+
33+
- [Create a dynamic storage pool](#create-a-dynamic-storage-pool)
34+
- [Create a pre-provisioned storage pool](#create-a-pre-provisioned-storage-pool) using pre-provisioned Azure managed disks
35+
- [Create a dynamic storage pool using your own encryption key (optional)](#create-a-dynamic-storage-pool-using-your-own-encryption-key-optional)
36+
37+
If you enabled Azure Container Storage using `az aks create` or `az aks update` commands, you might already have a storage pool. Use `kubectl get sp -n acstor` to get the list of storage pools. If you have a storage pool already available that you want to use, you can skip this step and proceed to [Display the available storage classes](#display-the-available-storage-classes).
2838

29-
Follow these steps to create a storage pool for Azure Disks. You can also:
30-
- [Create a storage pool with a pre-provisioned Azure managed disk](#create-a-pre-provisioned-storage-pool)
31-
- [Create a storage pool that has server-side encryption with customer managed keys enabled](#enable-server-side-encryption-with-customer-managed-keys)
39+
#### Create a dynamic storage pool
40+
41+
Follow these steps to create a dynamic storage pool for Azure Disks.
3242

3343
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-storagepool.yaml`.
3444

@@ -69,7 +79,115 @@ Follow these steps to create a storage pool for Azure Disks. You can also:
6979

7080
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).
7181

72-
## Display the available storage classes
82+
#### Create a pre-provisioned storage pool
83+
84+
If you have Azure managed disks that are already provisioned, you can create a pre-provisioned storage pool using those disks. Because the disks are already provisioned, you don't need to specify the skuName or storage capacity when creating the storage pool.
85+
86+
Follow these steps to create a pre-provisioned storage pool for Azure Disks.
87+
88+
1. Sign in to the Azure portal.
89+
90+
1. For each disk that you want to use, navigate to the Azure managed disk and select **Settings** > **Properties**. Copy the entire string under **Resource ID** and put it in a text file.
91+
92+
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-storagepool.yaml`.
93+
94+
1. Paste in the following code. The storage pool **name** value can be whatever you want. Replace `<resource-id>` with the resource ID of each managed disk. Save the file.
95+
96+
```yml
97+
apiVersion: containerstorage.azure.com/v1
98+
kind: StoragePool
99+
metadata:
100+
name: sp-preprovisioned
101+
namespace: acstor
102+
spec:
103+
poolType:
104+
azureDisk:
105+
disks:
106+
- reference <resource-id1>
107+
- reference <resource-id2>
108+
```
109+
110+
1. Apply the YAML manifest file to create the storage pool.
111+
112+
```azurecli-interactive
113+
kubectl apply -f acstor-storagepool.yaml
114+
```
115+
116+
When storage pool creation is complete, you'll see a message like:
117+
118+
```output
119+
storagepool.containerstorage.azure.com/sp-preprovisioned created
120+
```
121+
122+
You can also run this command to check the status of the storage pool. Replace `<storage-pool-name>` with your storage pool **name** value. For this example, the value would be **sp-preprovisioned**.
123+
124+
```azurecli-interactive
125+
kubectl describe sp <storage-pool-name> -n acstor
126+
```
127+
128+
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).
129+
130+
#### Create a dynamic storage pool using your own encryption key (optional)
131+
132+
All data in an Azure storage account is encrypted at rest. By default, data is encrypted with Microsoft-managed keys. For more control over encryption keys, you can supply customer-managed keys (CMK) when you create your storage pool to encrypt the persistent volumes that you'll create.
133+
134+
To use your own key for server-side encryption, you must have an [Azure Key Vault](../../key-vault/general/overview.md) with a key. The Key Vault should have purge protection enabled, and it must use the Azure RBAC permission model. Learn more about [customer-managed keys on Linux](../../virtual-machines/disk-encryption.md#customer-managed-keys).
135+
136+
When creating your storage pool, you must define the CMK parameters. The required CMK encryption parameters are:
137+
138+
- **keyVersion** specifies the version of the key to use
139+
- **keyName** is the name of your key
140+
- **keyVaultUri** is the uniform resource identifier of the Azure Key Vault, for example `https://user.vault.azure.net`
141+
- **Identity** specifies a managed identity with access to the vault, for example `/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourcegroups/MC_user-acstor-westus2-rg_user-acstor-westus2_westus2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-acstor-westus2-agentpool`
142+
143+
Follow these steps to create a storage pool using your own encryption key. All persistent volumes created from this storage pool will be encrypted using the same key.
144+
145+
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-storagepool-cmk.yaml`.
146+
147+
1. Paste in the following code, supply the required parameters, and save the file. The storage pool **name** value can be whatever you want. For **skuName**, specify the level of performance and redundancy. Acceptable values are Premium_LRS, Standard_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, PremiumV2_LRS, and StandardSSD_ZRS. For **storage**, specify the amount of storage capacity for the pool in Gi or Ti. Be sure to supply the CMK encryption parameters.
148+
149+
```yml
150+
apiVersion: containerstorage.azure.com/v1
151+
kind: StoragePool
152+
metadata:
153+
name: azuredisk
154+
namespace: acstor
155+
spec:
156+
poolType:
157+
azureDisk:
158+
skuName: Premium_LRS
159+
encryption: {
160+
keyVersion: "<key-version>",
161+
keyName: "<key-name>",
162+
keyVaultUri: "<key-vault-uri>",
163+
identity: "<identity>"
164+
}
165+
resources:
166+
requests:
167+
storage: 1Ti
168+
```
169+
170+
1. Apply the YAML manifest file to create the storage pool.
171+
172+
```azurecli-interactive
173+
kubectl apply -f acstor-storagepool-cmk.yaml
174+
```
175+
176+
When storage pool creation is complete, you'll see a message like:
177+
178+
```output
179+
storagepool.containerstorage.azure.com/azuredisk created
180+
```
181+
182+
You can also run this command to check the status of the storage pool. Replace `<storage-pool-name>` with your storage pool **name** value. For this example, the value would be **azuredisk**.
183+
184+
```azurecli-interactive
185+
kubectl describe sp <storage-pool-name> -n acstor
186+
```
187+
188+
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>`.
189+
190+
### 2. Display the available storage classes
73191

74192
When the storage pool is ready to use, you must select a storage class to define how storage is dynamically created when creating persistent volume claims and deploying persistent volumes.
75193

@@ -78,7 +196,7 @@ Run `kubectl get sc` to display the available storage classes. You should see a
78196
> [!IMPORTANT]
79197
> 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.
80198
81-
## Create a persistent volume claim
199+
### 3. Create a persistent volume claim
82200

83201
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.
84202

@@ -120,7 +238,7 @@ A persistent volume claim (PVC) is used to automatically provision storage based
120238

121239
Once the PVC is created, it's ready for use by a pod.
122240

123-
## Deploy a pod and attach a persistent volume
241+
### 4. Deploy a pod and attach a persistent volume
124242

125243
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.
126244

@@ -178,117 +296,11 @@ Create a pod using [Fio](https://github.com/axboe/fio) (Flexible I/O Tester) for
178296

179297
You've now deployed a pod that's using Azure Disks as its storage, and you can use it for your Kubernetes workloads.
180298

181-
## Create a pre-provisioned storage pool
182-
183-
If you have Azure managed disks that are already provisioned, you can create a pre-provisioned storage pool using those disks. Because the disks are already provisioned, you don't need to specify the skuName or storage capacity when creating the storage pool.
184-
185-
Follow these steps to create a pre-provisioned storage pool for Azure Disks.
186-
187-
1. Sign in to the Azure portal.
188-
189-
1. For each disk that you want to use, navigate to the Azure managed disk and select **Settings** > **Properties**. Copy the entire string under **Resource ID** and put it in a text file.
190-
191-
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-storagepool.yaml`.
192-
193-
1. Paste in the following code. The storage pool **name** value can be whatever you want. Replace `<resource-id>` with the resource ID of each managed disk. Save the file.
194-
195-
```yml
196-
apiVersion: containerstorage.azure.com/v1
197-
kind: StoragePool
198-
metadata:
199-
name: sp-preprovisioned
200-
namespace: acstor
201-
spec:
202-
poolType:
203-
azureDisk:
204-
disks:
205-
- reference <resource-id1>
206-
- reference <resource-id2>
207-
```
208-
209-
1. Apply the YAML manifest file to create the storage pool.
210-
211-
```azurecli-interactive
212-
kubectl apply -f acstor-storagepool.yaml
213-
```
214-
215-
When storage pool creation is complete, you'll see a message like:
216-
217-
```output
218-
storagepool.containerstorage.azure.com/sp-preprovisioned created
219-
```
220-
221-
You can also run this command to check the status of the storage pool. Replace `<storage-pool-name>` with your storage pool **name** value. For this example, the value would be **sp-preprovisioned**.
222-
223-
```azurecli-interactive
224-
kubectl describe sp <storage-pool-name> -n acstor
225-
```
226-
227-
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).
228-
229-
## Enable server-side encryption with customer-managed keys
230-
231-
If you already created a storage pool or you prefer to use the default Microsoft-managed encryption keys, skip this section and proceed to [Display the available storage classes](#display-the-available-storage-classes).
232-
233-
All data in an Azure storage account is encrypted at rest. By default, data is encrypted with Microsoft-managed keys. For more control over encryption keys, you can supply customer-managed keys (CMK) to encrypt the persistent volumes that you'll create from an Azure Disk storage pool.
234-
235-
To use your own key, you must have an [Azure Key Vault](../../key-vault/general/overview.md) with a key. The Key Vault should have purge protection enabled, and it must use the Azure RBAC permission model. Learn more about [customer-managed keys on Linux](../../virtual-machines/disk-encryption.md#customer-managed-keys).
299+
## Manage persistent volumes and storage pools
236300

237-
When creating your storage pool, you must define the CMK parameters. The required CMK encryption parameters are:
238-
239-
- **keyVersion** specifies the version of the key to use
240-
- **keyName** is the name of your key
241-
- **keyVaultUri** is the uniform resource identifier of the Azure Key Vault, for example `https://user.vault.azure.net`
242-
- **Identity** specifies a managed identity with access to the vault, for example `/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourcegroups/MC_user-acstor-westus2-rg_user-acstor-westus2_westus2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-acstor-westus2-agentpool`
243-
244-
Follow these steps to create a storage pool using your own encryption key. All persistent volumes created from this storage pool will be encrypted using the same key.
245-
246-
1. Use your favorite text editor to create a YAML manifest file such as `code acstor-storagepool-cmk.yaml`.
247-
248-
1. Paste in the following code, supply the required parameters, and save the file. The storage pool **name** value can be whatever you want. For **skuName**, specify the level of performance and redundancy. Acceptable values are Premium_LRS, Standard_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, PremiumV2_LRS, and StandardSSD_ZRS. For **storage**, specify the amount of storage capacity for the pool in Gi or Ti. Be sure to supply the CMK encryption parameters.
249-
250-
```yml
251-
apiVersion: containerstorage.azure.com/v1
252-
kind: StoragePool
253-
metadata:
254-
name: azuredisk
255-
namespace: acstor
256-
spec:
257-
poolType:
258-
azureDisk:
259-
skuName: Premium_LRS
260-
encryption: {
261-
keyVersion: "<key-version>",
262-
keyName: "<key-name>",
263-
keyVaultUri: "<key-vault-uri>",
264-
identity: "<identity>"
265-
}
266-
resources:
267-
requests:
268-
storage: 1Ti
269-
```
270-
271-
1. Apply the YAML manifest file to create the storage pool.
272-
273-
```azurecli-interactive
274-
kubectl apply -f acstor-storagepool-cmk.yaml
275-
```
276-
277-
When storage pool creation is complete, you'll see a message like:
278-
279-
```output
280-
storagepool.containerstorage.azure.com/azuredisk created
281-
```
282-
283-
You can also run this command to check the status of the storage pool. Replace `<storage-pool-name>` with your storage pool **name** value. For this example, the value would be **azuredisk**.
284-
285-
```azurecli-interactive
286-
kubectl describe sp <storage-pool-name> -n acstor
287-
```
288-
289-
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>`.
301+
Now that you've created a persistent volume, you can detach and reattach it as needed. You can also expand or delete a storage pool.
290302

291-
## Detach and reattach a persistent volume
303+
### Detach and reattach a persistent volume
292304

293305
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**.
294306

@@ -300,7 +312,7 @@ To reattach a persistent volume, simply reference the persistent volume claim na
300312

301313
To check which persistent volume a persistent volume claim is bound to, run `kubectl get pvc <persistent-volume-claim-name>`.
302314

303-
## Expand a storage pool
315+
### Expand a storage pool
304316

305317
You can expand storage pools backed by Azure Disks to scale up quickly and without downtime. Shrinking storage pools isn't currently supported.
306318

@@ -336,7 +348,7 @@ Follow these instructions to expand an existing storage pool for Azure Disks.
336348

337349
1. Run `kubectl get sp -A` and the storage pool should reflect the new size.
338350

339-
## Delete a storage pool
351+
### Delete a storage pool
340352

341353
If you want to delete a storage pool, run the following command. Replace `<storage-pool-name>` with the storage pool name.
342354

0 commit comments

Comments
 (0)