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
description: Learn how to enable the Container Storage Interface (CSI) drivers for Azure disks and Azure Files in an Azure Kubernetes Service (AKS) cluster.
4
4
services: container-service
5
5
ms.topic: article
6
-
ms.date: 03/11/2022
6
+
ms.date: 05/06/2022
7
7
author: palma21
8
8
9
9
---
10
10
11
-
# Enable Container Storage Interface (CSI) drivers for Azure disks and Azure Files on Azure Kubernetes Service (AKS)
11
+
# Enable Container Storage Interface (CSI) drivers on Azure Kubernetes Service (AKS)
12
12
13
13
The Container Storage Interface (CSI) is a standard for exposing arbitrary block and file storage systems to containerized workloads on Kubernetes. By adopting and using CSI, Azure Kubernetes Service (AKS) can write, deploy, and iterate plug-ins to expose new or improve existing storage systems in Kubernetes without having to touch the core Kubernetes code and wait for its release cycles.
14
14
15
15
The CSI storage driver support on AKS allows you to natively use:
16
-
-[*Azure disks*](azure-disk-csi.md), which can be used to create a Kubernetes *DataDisk* resource. Disks can use Azure Premium Storage, backed by high-performance SSDs, or Azure Standard Storage, backed by regular HDDs or Standard SSDs. For most production and development workloads, use Premium Storage. Azure disks are mounted as *ReadWriteOnce*, so are only available to a single pod. For storage volumes that can be accessed by multiple pods simultaneously, use Azure Files.
17
-
-[*Azure Files*](azure-files-csi.md), which can be used to mount an SMB 3.0/3.1 share backed by an Azure Storage account to pods. With Azure Files, you can share data across multiple nodes and pods. Azure Files can use Azure Standard Storage backed by regular HDDs or Azure Premium Storage backed by high-performance SSDs.
18
16
19
-
> [!IMPORTANT]
20
-
> Starting in Kubernetes version 1.21, AKS will use CSI drivers only and by default. CSI migration is also turned on starting from AKS 1.21, existing in-tree persistent volumes continue to function as they always have; however, behind the scenes Kubernetes hands control of all storage management operations (previously targeting in-tree drivers) to CSI drivers.
21
-
>
22
-
> Please remove manual installed open source Azure Disk and Azure File CSI drivers before upgrading to AKS 1.21.
23
-
>
24
-
> *In-tree drivers* refers to the current storage drivers that are part of the core Kubernetes code versus the new CSI drivers, which are plug-ins.
25
-
26
-
## Install CSI storage drivers on a new cluster with version < 1.21
27
-
28
-
Create a new cluster that can use CSI storage drivers for Azure disks and Azure Files by using the following CLI commands. Use the `--aks-custom-headers` flag to set the `EnableAzureDiskFileCSIDriver` feature.
29
-
30
-
Create an Azure resource group:
31
-
32
-
```azurecli-interactive
33
-
# Create an Azure resource group
34
-
az group create --name myResourceGroup --location canadacentral
35
-
```
36
-
37
-
Create the AKS cluster with support for CSI storage drivers:
38
-
39
-
```azurecli-interactive
40
-
# Create an AKS-managed Azure AD cluster
41
-
az aks create -g MyResourceGroup -n MyManagedCluster --network-plugin azure --aks-custom-headers EnableAzureDiskFileCSIDriver=true
42
-
```
17
+
-[**Azure disks**](azure-disk-csi.md) can be used to create a Kubernetes *DataDisk* resource. Disks can use Azure Premium Storage, backed by high-performance SSDs, or Azure Standard Storage, backed by regular HDDs or Standard SSDs. For most production and development workloads, use Premium Storage. Azure disks are mounted as *ReadWriteOnce* and are only available to a single pod. For storage volumes that can be accessed by multiple pods simultaneously, use Azure Files.
18
+
-[**Azure Files**](azure-files-csi.md) can be used to mount an SMB 3.0/3.1 share backed by an Azure storage account to pods. With Azure Files, you can share data across multiple nodes and pods. Azure Files can use Azure Standard storage backed by regular HDDs or Azure Premium storage backed by high-performance SSDs.
43
19
44
-
If you want to create clusters in tree storage drivers instead of CSI storage drivers, you can do so by omitting the custom `--aks-custom-headers` parameter. Starting in Kubernetes version 1.21, Kubernetes will use CSI drivers only and by default.
45
-
46
-
47
-
Check how many Azure disk-based volumes you can attach to this node by running:
48
-
49
-
```console
50
-
$ kubectl get nodes
51
-
aks-nodepool1-25371499-vmss000000
52
-
aks-nodepool1-25371499-vmss000001
53
-
aks-nodepool1-25371499-vmss000002
54
-
55
-
$ echo$(kubectl get CSINode <NODE NAME> -o jsonpath="{.spec.drivers[1].allocatable.count}")
56
-
8
57
-
```
58
-
59
-
## Install CSI storage drivers on an existing cluster with version < 1.21
60
-
-[Set up Azure Disk CSI driver on AKS cluster](https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/master/docs/install-driver-on-aks.md)
61
-
-[Set up Azure File CSI driver on AKS cluster](https://github.com/kubernetes-sigs/azurefile-csi-driver/blob/master/docs/install-driver-on-aks.md)
20
+
> [!IMPORTANT]
21
+
> Starting with Kubernetes version 1.21, AKS only uses CSI drivers by default. CSI migration is also turned on starting with AKS 1.21, and existing in-tree persistent volumes continue to function. However, internally Kubernetes hands control of all storage management operations (previously targeting in-tree drivers) to CSI drivers.
22
+
>
23
+
> *In-tree drivers* refers to the current storage drivers that are part of the core Kubernetes code opposed to the new CSI drivers, which are plug-ins.
62
24
63
25
## Migrating custom in-tree storage classes to CSI
64
-
If you have created in-tree driver storage classes, those storage classes will continue to work since CSI migration is turned on after upgrading your cluster to 1.21.x, while if you want to use CSI features (snapshotting etc.) you will need to carry out the migration.
65
26
66
-
Migration of these storage classes will involve deleting the existing storage classes, and re-creating them with the provisioner set to **disk.csi.azure.com** if using Azure Disks, and **files.csi.azure.com** if using Azure Files.
27
+
If you created in-tree driver storage classes, those storage classes continue to work since CSI migration is turned on after upgrading your cluster to 1.21.x. If you want to use CSI features you'll need to perform the migration.
28
+
29
+
Migrating these storage classes involves deleting the existing ones, and re-creating them with the provisioner set to **disk.csi.azure.com** if using Azure disk storage, and **files.csi.azure.com** if using Azure Files.
67
30
68
31
### Migrating Storage Class provisioner
69
32
70
-
As an example for Azure disks:
33
+
The following example shows how to migrate to Azure disk. The CSI storage system supports the same features as the in-tree drivers, so the only change needed would be the provisioner.
71
34
72
-
#### Original In-tree storage class definition
35
+
#### Original in-tree storage class definition
73
36
74
37
```yaml
75
38
kind: StorageClass
@@ -95,12 +58,10 @@ parameters:
95
58
storageAccountType: Premium_LRS
96
59
```
97
60
98
-
The CSI storage system supports the same features as the In-tree drivers, so the only change needed would be the provisioner.
99
-
100
61
## Migrating in-tree persistent volumes
101
62
102
63
> [!IMPORTANT]
103
-
> If your in-tree Persistent Volume reclaimPolicy is set to Delete you will need to change the Persistent Volume to Retain to persist your data. This can be achieved via a [patch operation on the PV](https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/). For example:
64
+
> If your in-tree persistent volume reclaimPolicy is set to **Delete**, you need to change the Persistent Volume to Retain to persist your data. This can be achieved via a [patch operation on the PV](https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/). For example:
0 commit comments