1 # Azure Disk CSI Driver
3 The Azure Disk CSI driver allows you to provision volumes for pods with a Kubernetes deployment over Azure Cloud. The CSI driver replaces to volume provisioning done by the in-tree azure cloud provider which is deprecated.
5 This documentation is an updated version of the in-tree Azure cloud provider documentation (azure.md).
7 To deploy Azure Disk CSI driver, uncomment the `azure_csi_enabled` option in `group_vars/all/azure.yml` and set it to `true`.
9 ## Azure Disk CSI Storage Class
11 If you want to deploy the Azure Disk storage class to provision volumes dynamically, you should set `persistent_volumes_enabled` in `group_vars/k8s_cluster/k8s_cluster.yml` to `true`.
15 Before creating the instances you must first set the `azure_csi_` variables in the `group_vars/all.yml` file.
17 All of the values can be retrieved using the azure cli tool which can be downloaded here: <https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest>
19 After installation you have to run `az login` to get access to your account.
21 ### azure\_csi\_tenant\_id + azure\_csi\_subscription\_id
23 Run `az account show` to retrieve your subscription id and tenant id:
24 `azure_csi_tenant_id` -> tenantId field
25 `azure_csi_subscription_id` -> id field
27 ### azure\_csi\_location
29 The region your instances are located in, it can be something like `francecentral` or `norwayeast`. A full list of region names can be retrieved via `az account list-locations`
31 ### azure\_csi\_resource\_group
33 The name of the resource group your instances are in, a list of your resource groups can be retrieved via `az group list`
35 Or you can do `az vm list | grep resourceGroup` and get the resource group corresponding to the VMs of your cluster.
37 The resource group name is not case sensitive.
39 ### azure\_csi\_vnet\_name
41 The name of the virtual network your instances are in, can be retrieved via `az network vnet list`
43 ### azure\_csi\_vnet\_resource\_group
45 The name of the resource group your vnet is in, can be retrieved via `az network vnet list | grep resourceGroup` and get the resource group corresponding to the vnet of your cluster.
47 ### azure\_csi\_subnet\_name
49 The name of the subnet your instances are in, can be retrieved via `az network vnet subnet list --resource-group RESOURCE_GROUP --vnet-name VNET_NAME`
51 ### azure\_csi\_security\_group\_name
53 The name of the network security group your instances are in, can be retrieved via `az network nsg list`
55 ### azure\_csi\_aad\_client\_id + azure\_csi\_aad\_client\_secret
57 These will have to be generated first:
59 - Create an Azure AD Application with:
60 `az ad app create --display-name kubespray --identifier-uris http://kubespray --homepage http://kubespray.com --password CLIENT_SECRET`
62 Display name, identifier-uri, homepage and the password can be chosen
64 Note the AppId in the output.
66 - Create Service principal for the application with:
67 `az ad sp create --id AppId`
69 This is the AppId from the last command
71 - Create the role assignment with:
72 `az role assignment create --role "Owner" --assignee http://kubespray --subscription SUBSCRIPTION_ID`
74 azure\_csi\_aad\_client\_id must be set to the AppId, azure\_csi\_aad\_client\_secret is your chosen secret.
76 ### azure\_csi\_use\_instance\_metadata
78 Use instance metadata service where possible. Boolean value.
80 ## Test the Azure Disk CSI driver
82 To test the dynamic provisioning using Azure CSI driver, make sure to have the storage class deployed (through persistent volumes), and apply the following manifest:
87 kind: PersistentVolumeClaim
96 storageClassName: disk.csi.azure.com
101 name: nginx-azuredisk
104 kubernetes.io/os: linux
107 name: nginx-azuredisk
111 - while true; do echo $(date) >> /mnt/azuredisk/outfile; sleep 1; done
114 mountPath: "/mnt/azuredisk"
117 persistentVolumeClaim:
118 claimName: pvc-azuredisk