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/10/2022
6
+
ms.date: 03/11/2022
7
7
author: palma21
8
8
9
9
---
@@ -17,18 +17,12 @@ The CSI storage driver support on AKS allows you to natively use:
17
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
18
19
19
> [!IMPORTANT]
20
-
> Starting in Kubernetes version 1.21, Kubernetes will use CSI drivers only and by default. These drivers are the future of storage support in Kubernetes.
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
21
>
22
22
> Please remove manual installed open source Azure Disk and Azure File CSI drivers before upgrading to AKS 1.21.
23
23
>
24
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
25
26
-
## Limitations
27
-
28
-
- This feature can only be set at cluster creation time.
29
-
- The minimum Kubernetes minor version that supports CSI drivers is v1.17.
30
-
- The default storage class will be the `managed-csi` storage class.
31
-
32
26
## Install CSI storage drivers on a new cluster with version < 1.21
33
27
34
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.
-[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)
68
62
69
63
## Migrating custom in-tree storage classes to CSI
70
-
If you have created custom storage classes based on the in-tree storage drivers, these will need to be migrated when you have upgraded your cluster to 1.21.x.
71
-
72
-
Whilst explicit migration to the CSI provider is not needed for your storage classes to still be valid, to be able to use CSI features (snapshotting etc.) you will need to carry out the migration.
73
-
74
-
Migration of these storage classes will involve deleting the existing storage classes, and re-provisioning them with the provisioner set to **disk.csi.azure.com** if using Azure Disks, and **files.csi.azure.com** if using Azure Files.
75
-
76
-
Whilst this will update the mapping of the storage classes, the binding of the Persistent Volume to the CSI provisioner will only take place at provisioning time. This could be during a cordon & drain operation (cluster update) or by detaching and reattaching the Volume.
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.
77
65
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.
78
67
79
68
### Migrating Storage Class provisioner
80
69
@@ -86,12 +75,11 @@ As an example for Azure disks:
86
75
kind: StorageClass
87
76
apiVersion: storage.k8s.io/v1
88
77
metadata:
89
-
name: managed-premium-retain
78
+
name: custom-managed-premium
90
79
provisioner: kubernetes.io/azure-disk
91
-
reclaimPolicy: Retain
80
+
reclaimPolicy: Delete
92
81
parameters:
93
-
storageaccounttype: Premium_LRS
94
-
kind: Managed
82
+
storageAccountType: Premium_LRS
95
83
```
96
84
97
85
#### CSI storage class definition
@@ -100,26 +88,30 @@ parameters:
100
88
kind: StorageClass
101
89
apiVersion: storage.k8s.io/v1
102
90
metadata:
103
-
name: managed-premium-retain
91
+
name: custom-managed-premium
104
92
provisioner: disk.csi.azure.com
105
-
reclaimPolicy: Retain
93
+
reclaimPolicy: Delete
106
94
parameters:
107
-
storageaccounttype: Premium_LRS
108
-
kind: Managed
95
+
storageAccountType: Premium_LRS
109
96
```
110
97
111
98
The CSI storage system supports the same features as the In-tree drivers, so the only change needed would be the provisioner.
112
99
113
-
114
-
### Migrating in-tree disk persistent volumes
100
+
## Migrating in-tree persistent volumes
115
101
116
102
> [!IMPORTANT]
117
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:
If you have in-tree persistent volumes, get disk ID from `azureDisk.diskURI` and then follow this [guide][azure-disk-static-mount] to set up CSI driver persistent volumes
108
+
### Migrating in-tree Azure Disk persistent volumes
109
+
110
+
If you have in-tree Azure Disk persistent volumes, get `diskURI` from in-tree persistent volumes and then follow this [guide][azure-disk-static-mount] to set up CSI driver persistent volumes
If you have in-tree Azure File persistent volumes, get `secretName`, `shareName` from in-tree persistent volumes and then follow this [guide][azure-file-static-mount] to set up CSI driver persistent volumes
123
115
124
116
## Next steps
125
117
@@ -140,6 +132,7 @@ If you have in-tree persistent volumes, get disk ID from `azureDisk.diskURI` and
0 commit comments