|
1 | 1 | ---
|
2 | 2 | title: Quickstart for using Azure Container Storage Preview with Azure Kubernetes Service (AKS)
|
3 |
| -description: Learn how to install Azure Container Storage Preview on an Azure Kubernetes Service cluster using an installation script. |
| 3 | +description: Create a Linux-based Azure Kubernetes Service (AKS) cluster, install Azure Container Storage, and create a storage pool. |
4 | 4 | author: khdownie
|
5 | 5 | ms.service: azure-container-storage
|
6 | 6 | ms.topic: quickstart
|
7 |
| -ms.date: 09/20/2023 |
| 7 | +ms.date: 11/03/2023 |
8 | 8 | ms.author: kendownie
|
| 9 | +ms.custom: devx-track-azurecli |
9 | 10 | ---
|
10 | 11 |
|
11 | 12 | # Quickstart: Use Azure Container Storage Preview with Azure Kubernetes Service
|
12 |
| -[Azure Container Storage](container-storage-introduction.md) is a cloud-based volume management, deployment, and orchestration service built natively for containers. This Quickstart shows you how to install Azure Container Storage Preview on an [Azure Kubernetes Service (AKS)](../../aks/intro-kubernetes.md) cluster using a provided installation script. |
| 13 | + |
| 14 | +[Azure Container Storage](container-storage-introduction.md) is a cloud-based volume management, deployment, and orchestration service built natively for containers. This Quickstart shows you how to create a Linux-based [Azure Kubernetes Service (AKS)](../../aks/intro-kubernetes.md) cluster, install Azure Container Storage, and create a storage pool using Azure CLI. |
13 | 15 |
|
14 | 16 | ## Prerequisites
|
15 | 17 |
|
16 | 18 | [!INCLUDE [container-storage-prerequisites](../../../includes/container-storage-prerequisites.md)]
|
17 | 19 |
|
18 |
| -- You'll need an AKS cluster with an appropriate [virtual machine type](install-container-storage-aks.md#vm-types). If you don't already have an AKS cluster, follow [these instructions](install-container-storage-aks.md#getting-started) to create one. |
| 20 | +> [!IMPORTANT] |
| 21 | +> This Quickstart will work for most use cases. An exception is if you plan to use Azure Elastic SAN Preview as backing storage for your storage pool and you don't have owner-level access to the Azure subscription. If both these statements apply to you, use the [manual installation steps](install-container-storage-aks.md) instead. Alternatively, you can complete this Quickstart with the understanding that a storage pool won't be automatically created, and then [create an Elastic SAN storage pool manually](use-container-storage-with-elastic-san.md). |
| 22 | +
|
| 23 | +## Getting started |
| 24 | + |
| 25 | +- Take note of your Azure subscription ID. We recommend using a subscription on which you have an [Owner](../../role-based-access-control/built-in-roles.md#owner) role. |
| 26 | + |
| 27 | +- [Launch Azure Cloud Shell](https://shell.azure.com), or if you're using a local installation, sign in to the Azure CLI by using the [az login](/cli/azure/reference-index#az-login) command. |
| 28 | + |
| 29 | +- If you're using Azure Cloud Shell, you might be prompted to mount storage. Select the Azure subscription where you want to create the storage account and select **Create**. |
| 30 | + |
| 31 | +## Install the required extensions |
| 32 | + |
| 33 | +Upgrade to the latest version of the `aks-preview` cli extension by running the following command. |
| 34 | + |
| 35 | +```azurecli-interactive |
| 36 | +az extension add --upgrade --name aks-preview |
| 37 | +``` |
| 38 | + |
| 39 | +Add or upgrade to the latest version of k8s-extension by running the following command. |
| 40 | + |
| 41 | +```azurecli-interactive |
| 42 | +az extension add --upgrade --name k8s-extension |
| 43 | +``` |
| 44 | + |
| 45 | +## Set subscription context |
| 46 | + |
| 47 | +Set your Azure subscription context using the `az account set` command. You can view the subscription IDs for all the subscriptions you have access to by running the `az account list --output table` command. Remember to replace `<subscription-id>` with your subscription ID. |
| 48 | + |
| 49 | +```azurecli-interactive |
| 50 | +az account set --subscription <subscription-id> |
| 51 | +``` |
| 52 | + |
| 53 | +## Register resource providers |
| 54 | + |
| 55 | +The `Microsoft.ContainerService` and `Microsoft.KubernetesConfiguration` resource providers must be registered on your Azure subscription. To register these providers, run the following commands: |
| 56 | + |
| 57 | +```azurecli-interactive |
| 58 | +az provider register --namespace Microsoft.ContainerService --wait |
| 59 | +az provider register --namespace Microsoft.KubernetesConfiguration --wait |
| 60 | +``` |
| 61 | + |
| 62 | +## Create a resource group |
| 63 | + |
| 64 | +An Azure resource group is a logical group that holds your Azure resources that you want to manage as a group. If you already have a resource group you want to use, you can skip this section. |
| 65 | + |
| 66 | +When you create a resource group, you're prompted to specify a location. This location is: |
| 67 | + |
| 68 | +* The storage location of your resource group metadata. |
| 69 | +* Where your resources will run in Azure if you don't specify another region during resource creation. |
| 70 | + |
| 71 | +Create a resource group using the `az group create` command. Replace `<resource-group-name>` with the name of the resource group you want to create, and replace `<location>` with an Azure region such as *eastus*, *westus2*, *westus3*, or *westeurope*. See this [list of Azure regions](container-storage-introduction.md#regional-availability) where Azure Container Storage is available. |
| 72 | + |
| 73 | +```azurecli-interactive |
| 74 | +az group create --name <resource-group-name> --location <location> |
| 75 | +``` |
| 76 | + |
| 77 | +If the resource group was created successfully, you'll see output similar to this: |
| 78 | + |
| 79 | +```output |
| 80 | +{ |
| 81 | + "id": "/subscriptions/<guid>/resourceGroups/myContainerStorageRG", |
| 82 | + "location": "eastus", |
| 83 | + "managedBy": null, |
| 84 | + "name": "myContainerStorageRG", |
| 85 | + "properties": { |
| 86 | + "provisioningState": "Succeeded" |
| 87 | + }, |
| 88 | + "tags": null |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +## Choose a data storage option for your storage pool |
| 93 | + |
| 94 | +Before deploying Azure Container Storage, you'll need to decide which back-end storage option you want to use to create your storage pool and persistent volumes. Three options are currently available: |
| 95 | + |
| 96 | +- **Azure Elastic SAN Preview**: Azure Elastic SAN preview is a good fit for general purpose databases, streaming and messaging services, CI/CD environments, and other tier 1/tier 2 workloads. Storage is provisioned on demand per created volume and volume snapshot. Multiple clusters can access a single SAN concurrently, however persistent volumes can only be attached by one consumer at a time. |
| 97 | + |
| 98 | +- **Azure Disks**: Azure Disks are a good fit for databases such as MySQL, MongoDB, and PostgreSQL. Storage is provisioned per target container storage pool size and maximum volume size. |
| 99 | + |
| 100 | +- **Ephemeral Disk**: This option uses local NVMe drives on the AKS cluster nodes and is extremely latency sensitive (low sub-ms latency), so it's best for applications with no data durability requirement or with built-in data replication support such as Cassandra. AKS discovers the available ephemeral storage on AKS nodes and acquires the drives for volume deployment. |
| 101 | + |
| 102 | +You'll specify the storage pool type when you install Azure Container Storage. |
| 103 | + |
| 104 | +## Choose a VM type for your cluster |
| 105 | + |
| 106 | +If you intend to use Azure Elastic SAN Preview or Azure Disks as backing storage, then you should choose a [general purpose VM type](../../virtual-machines/sizes-general.md) such as **standard_d4s_v5** for the cluster nodes. If you intend to use Ephemeral Disk, choose a [storage optimized VM type](../../virtual-machines/sizes-storage.md) with NVMe drives such as **standard_l8s_v3**. In order to use Ephemeral Disk, the VMs must have NVMe drives. You'll specify the VM type when you create the cluster in the next section. |
19 | 107 |
|
20 | 108 | > [!IMPORTANT]
|
21 |
| -> If you created your AKS cluster using the Azure portal, it will likely have two node pools: a user node pool and a system/agent node pool. Before you can install Azure Container Storage, you must label the user node pool. In this article, this is done automatically by passing the user node pool name to the script as a parameter. However, if your cluster consists of only a system node pool, which is often the case with test/dev clusters, you'll need to first [add a new user node pool](../../aks/create-node-pools.md#add-a-node-pool) before running the script. This is because when you create an AKS cluster using the Azure portal, a taint `CriticalAddOnsOnly` gets added to the agent/system nodepool, which blocks installation of Azure Container Storage on the system node pool. This taint isn't added when an AKS cluster is created using Azure CLI. |
| 109 | +> You must choose a VM type that supports [Azure premium storage](../../virtual-machines/premium-storage-performance.md). Each VM should have a minimum of four virtual CPUs (vCPUs). Azure Container Storage will consume one core for I/O processing on every VM the extension is deployed to. |
22 | 110 |
|
23 |
| -## Install Azure Container Storage |
| 111 | +## Create a new AKS cluster and install Azure Container Storage |
24 | 112 |
|
25 |
| -[!INCLUDE [container-storage-script-install](../../../includes/container-storage-script-install.md)] |
| 113 | +If you already have an AKS cluster deployed, skip this section and go to [Install Azure Container Storage on an existing AKS cluster](#install-azure-container-storage-on-an-existing-aks-cluster). |
| 114 | + |
| 115 | +Run the following command to create a new AKS cluster, install Azure Container Storage, and create a storage pool. Replace `<cluster-name>` and `<resource-group-name>` with your own values, and specify which VM type you want to use. You'll need a node pool of at least three Linux VMs. Replace `<storage-pool-type>` with `azureDisk`, `ephemeraldisk`, or `elasticSan`. |
| 116 | + |
| 117 | +Optional storage pool parameters: |
| 118 | + |
| 119 | +| **Parameter** | **Default** | |
| 120 | +|----------------|-------------| |
| 121 | +| --storage-pool-name | mypool-<random 7 char lowercase> | |
| 122 | +| --storage-pool-size | 512Gi (1Ti for Elastic SAN) | |
| 123 | +| --storage-pool-sku | Premium_LRS | |
| 124 | +| --storage-pool-option | NVMe | |
| 125 | + |
| 126 | +```azurecli-interactive |
| 127 | +az aks create -n <cluster-name> -g <resource-group-name> --node-vm-size Standard_D4s_v3 --node-count 3 --enable-azure-container-storage <storage-pool-type> |
| 128 | +``` |
| 129 | + |
| 130 | +The deployment will take 10-15 minutes to complete. |
| 131 | + |
| 132 | +## Install Azure Container Storage on an existing AKS cluster |
| 133 | + |
| 134 | +If you already have an AKS cluster that meets the [VM requirements](#choose-a-vm-type-for-your-cluster), run the following command to install Azure Container Storage on the cluster and create a storage pool. Replace `<cluster-name>` and `<resource-group-name>` with your own values. Replace `<storage-pool-type>` with `azureDisk`, `ephemeraldisk`, or `elasticSan`. |
| 135 | + |
| 136 | +Running this command will enable Azure Container Storage on a node pool named `nodepool1`, which is the default node pool name. If you want to install it on other node pools, see [Install Azure Container Storage on specific node pools](#install-azure-container-storage-on-specific-node-pools). |
| 137 | + |
| 138 | +> [!IMPORTANT] |
| 139 | +> **If you created your AKS cluster using the Azure portal:** The cluster will likely have a user node pool and a system/agent node pool. However, if your cluster consists of only a system node pool, which is the case with test/dev clusters created with the Azure portal, you'll need to first [add a new user node pool](../../aks/create-node-pools.md#add-a-node-pool) and then label it. This is because when you create an AKS cluster using the Azure portal, a taint `CriticalAddOnsOnly` is added to the system/agent nodepool, which blocks installation of Azure Container Storage on the system node pool. This taint isn't added when an AKS cluster is created using Azure CLI. |
26 | 140 |
|
27 |
| -## Choose a data storage option |
| 141 | +```azurecli-interactive |
| 142 | +az aks update -n <cluster-name> -g <resource-group-name> --enable-azure-container-storage <storage-pool-type> |
| 143 | +``` |
28 | 144 |
|
29 |
| -Next you'll need to choose a back-end storage option to create your storage pool. Choose one of the following three options and follow the link to create a storage pool and persistent volume claim. |
| 145 | +The deployment will take 10-15 minutes to complete. |
30 | 146 |
|
31 |
| -- **Azure Elastic SAN Preview**: Azure Elastic SAN preview is a good fit for general purpose databases, streaming and messaging services, CD/CI environments, and other tier 1/tier 2 workloads. Storage is provisioned on demand per created volume and volume snapshot. Multiple clusters can access a single SAN concurrently, however persistent volumes can only be attached by one consumer at a time. [Create a storage pool using Azure Elastic SAN Preview](use-container-storage-with-elastic-san.md#create-a-storage-pool). |
| 147 | +### Install Azure Container Storage on specific node pools |
32 | 148 |
|
33 |
| -- **Azure Disks**: Azure Disks are a good fit for databases such as MySQL, MongoDB, and PostgreSQL. Storage is provisioned per target container storage pool size and maximum volume size. [Create a storage pool using Azure Disks](use-container-storage-with-managed-disks.md#create-a-storage-pool). |
| 149 | +If you want to install Azure Container Storage on specific node pools, follow these instructions. The node pools must contain at least three Linux VMs each. |
34 | 150 |
|
35 |
| -- **Ephemeral Disk**: This option uses local NVMe drives on the AKS nodes and is extremely latency sensitive (low sub-ms latency), so it's best for applications with no data durability requirement or with built-in data replication support such as Cassandra. AKS discovers the available ephemeral storage on AKS nodes and acquires the drives for volume deployment. [Create a storage pool using Ephemeral Disk](use-container-storage-with-local-disk.md#create-a-storage-pool). |
| 151 | +1. Run the following command to view the list of available node pools. Replace `<resource-group-name>` and `<cluster-name>` with your own values. |
| 152 | + |
| 153 | + ```azurecli-interactive |
| 154 | + az aks nodepool list --resource-group <resource-group-name> --cluster-name <cluster-name> |
| 155 | + ``` |
| 156 | + |
| 157 | +2. Run the following command to install Azure Container Storage on specific node pools. Replace `<cluster-name>` and `<resource-group-name>` with your own values. Replace `<storage-pool-type>` with `azureDisk`, `ephemeraldisk`, or `elasticSan`. |
| 158 | + |
| 159 | + ```azurecli-interactive |
| 160 | + az aks update -n <cluster-name> -g <resource-group-name> --enable-azure-container-storage <storage-pool-type> --azure-container-storage-nodepools <comma separated values of nodepool names> |
| 161 | + ``` |
0 commit comments