sigs.k8s.io/cluster-api-provider-azure@v1.14.3/docs/book/src/topics/data-disks.md (about) 1 # Data Disks 2 3 This document describes how to specify data disks to be provisioned and attached to VMs provisioned in Azure. 4 5 ## Azure Machine Data Disks 6 7 Azure Machines support optionally specifying a list of data disks to be attached to the virtual machine. Each data disk must have: 8 - `nameSuffix` - the name suffix of the disk to be created. Each disk will be named `<machineName>_<nameSuffix>` to ensure uniqueness. 9 - `diskSizeGB` - the disk size in GB. 10 - `managedDisk` - (optional) the managed disk for a VM (see below) 11 - `lun` - the logical unit number (see below) 12 13 ### Managed Disk Options 14 15 See [Introduction to Azure managed disks](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview) for more information. 16 17 ### Disk LUN 18 19 The LUN specifies the logical unit number of the data disk, between 0 and 63. Its value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. 20 21 When adding data disks to a Linux VM, you may encounter errors if a disk does not exist at LUN 0. It is therefore recommended to ensure that the first data disk specified is always added at LUN 0. 22 23 See [Attaching a disk to a Linux VM on Azure](https://learn.microsoft.com/azure/virtual-machines/linux/add-disk) for more information. 24 25 > IMPORTANT! The `lun` specified in the AzureMachine Spec must match the LUN used to refer to the device in Kubeadm diskSetup. See below for an example. 26 27 ### Ultra disk support for data disks 28 If we use StorageAccountType as `UltraSSD_LRS` in Managed Disks, the ultra disk support will be enabled for the region and zone which supports the `UltraSSDAvailable` capability. 29 30 To check all available vm-sizes in a given region which supports availability zone that has the `UltraSSDAvailable` capability supported, execute following using Azure CLI: 31 ```bash 32 az vm list-skus -l <location> -z -s <VM-size> 33 ``` 34 35 Provided that the chosen region and zone support Ultra disks, Azure Machine objects having Ultra disks specified as Data disks will have their virtual machines created with the `AdditionalCapabilities.UltraSSDEnabled` additional capability set to `true`. This capability can also be manually set on the Azure Machine spec and will override the automatically chosen value (if any). 36 37 When the chosen StorageAccountType is `UltraSSD_LRS`, caching is not supported for the disk and the corresponding `cachingType` field must be set to `None`. In this configuration, if no value is set, `cachingType` will be defaulted to `None`. 38 39 See [Ultra disk](https://learn.microsoft.com/azure/virtual-machines/disks-types#ultra-disk) for ultra disk performance and GA scope. 40 41 ### Ultra disk support for Persistent Volumes 42 First, to check all available vm-sizes in a given region which supports availability zone that has the `UltraSSDAvailable` capability supported, execute following using Azure CLI: 43 ```bash 44 az vm list-skus -l <location> -z -s <VM-size> 45 ``` 46 47 Provided that the chosen region and zone support Ultra disks, Ultra disk based Persistent Volumes can be attached to Pods scheduled on specific Azure Machines, provided that the spec field `.spec.additionalCapabilities.ultraSSDEnabled` on those Machines has been set to `true`. 48 NOTE: A misconfiguration or lack this field on the targeted Node's Machine will result in the Pod using the PV be unable to reach the Running Phase. 49 50 See [Use ultra disks dynamically with a storage class](https://learn.microsoft.com/azure/aks/use-ultra-disks#use-ultra-disks-dynamically-with-a-storage-class) for more information on how to configure an Ultra disk based StorageClass and PersistentVolumeClaim. 51 52 See [Ultra disk](https://learn.microsoft.com/azure/virtual-machines/disks-types#ultra-disk) for ultra disk performance and GA scope. 53 54 ## Configuring partitions, file systems and mounts 55 56 `KubeadmConfig` makes it easy to partition, format, and mount your data disk so your Linux VM can use it. Use the `diskSetup` and `mounts` options to describe partitions, file systems and mounts. 57 58 You may refer to your device as `/dev/disk/azure/scsi1/lun<i>` where `<i>` is the LUN. 59 60 See [cloud-init documentation](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#disk-setup) for more information about cloud-init disk setup. 61 62 63 ## Example 64 65 The below example shows how to create and attach a custom data disk "my_disk" at LUN 1 for every control plane machine, in addition to the etcd data disk. 66 NOTE: the same can be applied to worker machines. 67 68 ````yaml 69 kind: KubeadmControlPlane 70 apiVersion: controlplane.cluster.x-k8s.io/v1beta1 71 metadata: 72 name: "${CLUSTER_NAME}-control-plane" 73 spec: 74 [...] 75 diskSetup: 76 partitions: 77 - device: /dev/disk/azure/scsi1/lun0 78 tableType: gpt 79 layout: true 80 overwrite: false 81 - device: /dev/disk/azure/scsi1/lun1 82 tableType: gpt 83 layout: true 84 overwrite: false 85 filesystems: 86 - label: etcd_disk 87 filesystem: ext4 88 device: /dev/disk/azure/scsi1/lun0 89 extraOpts: 90 - "-E" 91 - "lazy_itable_init=1,lazy_journal_init=1" 92 - label: ephemeral0 93 filesystem: ext4 94 device: ephemeral0.1 95 replaceFS: ntfs 96 - label: my_disk 97 filesystem: ext4 98 device: /dev/disk/azure/scsi1/lun1 99 mounts: 100 - - LABEL=etcd_disk 101 - /var/lib/etcddisk 102 - - LABEL=my_disk 103 - /var/lib/mydir 104 --- 105 kind: AzureMachineTemplate 106 apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 107 metadata: 108 name: "${CLUSTER_NAME}-control-plane" 109 spec: 110 template: 111 spec: 112 [...] 113 dataDisks: 114 - nameSuffix: etcddisk 115 diskSizeGB: 256 116 managedDisk: 117 storageAccountType: Standard_LRS 118 lun: 0 119 - nameSuffix: mydisk 120 diskSizeGB: 128 121 lun: 1 122 ````