|
| 1 | +--- |
| 2 | +title: Use Azure Dedicated Hosts in Azure Kubernetes Service (AKS) (Preview) |
| 3 | +description: Learn how to create an Azure Dedicated Hosts Group and associate it with Azure Kubernetes Service (AKS) |
| 4 | +services: container-service |
| 5 | +ms.topic: article |
| 6 | +ms.date: 02/11/2021 |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +# Add Azure Dedicated Host to an Azure Kubernetes Service (AKS) cluster |
| 11 | + |
| 12 | +Azure Dedicated Host is a service that provides physical servers - able to host one or more virtual machines - dedicated to one Azure subscription. Dedicated hosts are the same physical servers used in our data centers, provided as a resource. You can provision dedicated hosts within a region, availability zone, and fault domain. Then, you can place VMs directly into your provisioned hosts, in whatever configuration best meets your needs. |
| 13 | + |
| 14 | +Using Azure Dedicated Hosts for nodes with your AKS cluster has the following benefits: |
| 15 | + |
| 16 | +* Hardware isolation at the physical server level. No other VMs will be placed on your hosts. Dedicated hosts are deployed in the same data centers and share the same network and underlying storage infrastructure as other, non-isolated hosts. |
| 17 | +* Control over maintenance events initiated by the Azure platform. While the majority of maintenance events have little to no impact on your virtual machines, there are some sensitive workloads where each second of pause can have an impact. With dedicated hosts, you can opt in to a maintenance window to reduce the impact to your service. |
| 18 | + |
| 19 | +[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)] |
| 20 | + |
| 21 | +## Before you begin |
| 22 | + |
| 23 | +* An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free). |
| 24 | +* [Azure CLI installed](/cli/azure/install-azure-cli). |
| 25 | + |
| 26 | +### Install the `aks-preview` Azure CLI |
| 27 | + |
| 28 | +You also need the *aks-preview* Azure CLI extension version 0.5.54 or later. Install the *aks-preview* Azure CLI extension by using the [az extension add][az-extension-add] command. Or install any available updates by using the [az extension update][az-extension-update] command. |
| 29 | + |
| 30 | +```azurecli-interactive |
| 31 | +# Install the aks-preview extension |
| 32 | +az extension add --name aks-preview |
| 33 | +# Update the extension to make sure you have the latest version installed |
| 34 | +az extension update --name aks-preview |
| 35 | +``` |
| 36 | + |
| 37 | +### Register the `DedicatedHostGroupPreview` preview feature |
| 38 | + |
| 39 | +To use the feature, you must also enable the `DedicatedHostGroupPreview` feature flag on your subscription. |
| 40 | + |
| 41 | +Register the `DedicatedHostGroupPreview` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example: |
| 42 | + |
| 43 | +```azurecli-interactive |
| 44 | +az feature register --namespace "Microsoft.ContainerService" --name "DedicatedHostGroupPreview" |
| 45 | +``` |
| 46 | + |
| 47 | +It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [az feature list][az-feature-list] command: |
| 48 | + |
| 49 | +```azurecli-interactive |
| 50 | +az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/DedicatedHostGroupPreview')].{Name:name,State:properties.state}" |
| 51 | +``` |
| 52 | + |
| 53 | +When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [az provider register][az-provider-register] command: |
| 54 | + |
| 55 | +```azurecli-interactive |
| 56 | +az provider register --namespace Microsoft.ContainerService |
| 57 | +``` |
| 58 | + |
| 59 | +## Limitations |
| 60 | + |
| 61 | +The following limitations apply when you integrate Azure Dedicated Host with Azure Kubernetes Service: |
| 62 | +* An existing agentpool cannot be converted from non-ADH to ADH or ADH to non-ADH. |
| 63 | +* It is not supported to update agentpool from host group A to host group B. |
| 64 | + |
| 65 | +## Add a Dedicated Host Group to an AKS cluster |
| 66 | + |
| 67 | +A host group is a resource that represents a collection of dedicated hosts. You create a host group in a region and an availability zone, and add hosts to it. When planning for high availability, there are additional options. You can use one or both of the following options with your dedicated hosts: |
| 68 | + |
| 69 | +Span across multiple availability zones. In this case, you are required to have a host group in each of the zones you wish to use. |
| 70 | +Span across multiple fault domains which are mapped to physical racks. |
| 71 | +In either case, you are need to provide the fault domain count for your host group. If you do not want to span fault domains in your group, use a fault domain count of 1. |
| 72 | + |
| 73 | +You can also decide to use both availability zones and fault domains. |
| 74 | + |
| 75 | +Not all host SKUs are available in all regions, and availability zones. You can list host availability, and any offer restrictions before you start provisioning dedicated hosts. |
| 76 | +```azurecli-interactive |
| 77 | +az vm list-skus -l eastus2 -r hostGroups/hosts -o table |
| 78 | +``` |
| 79 | + |
| 80 | +## Add Dedicated Hosts to the Host Group |
| 81 | + |
| 82 | +Now create a dedicated host in the host group. In addition to a name for the host, you are required to provide the SKU for the host. Host SKU captures the supported VM series as well as the hardware generation for your dedicated host. |
| 83 | + |
| 84 | +For more information about the host SKUs and pricing, see [Azure Dedicated Host pricing](https://azure.microsoft.com/pricing/details/virtual-machines/dedicated-host/). |
| 85 | + |
| 86 | +Use az vm host create to create a host. If you set a fault domain count for your host group, you will be asked to specify the fault domain for your host. |
| 87 | + |
| 88 | +In this example, we will use [az vm host group create](/cli/azure/vm/host/group#az_vm_host_group_create?view=azure-cli-latest&preserve-view=true) to create a host group using both availability zones and fault domains. |
| 89 | + |
| 90 | +```azurecli-interactive |
| 91 | +az vm host group create \ |
| 92 | +--name myHostGroup \ |
| 93 | +-g myDHResourceGroup \ |
| 94 | +-z 1\ |
| 95 | +--platform-fault-domain-count 2 |
| 96 | +``` |
| 97 | + |
| 98 | +## Create an AKS cluster using the Host Group |
| 99 | +Create an AKS cluster, and add the Host Group you just configured. |
| 100 | + |
| 101 | +```azurecli-interactive |
| 102 | +az aks create -g MyResourceGroup -n MyManagedCluster --location westus2 --kubernetes-version 1.20.13 --nodepool-name agentpool1 --node-count 1 --host-group-id <id> --node-vm-size Standard_D2s_v3 --enable-managed-identity --assign-identity <id> |
| 103 | +``` |
| 104 | + |
| 105 | +## Add a Dedicated Host Nodepool to an existing AKS cluster |
| 106 | +Add a Host Group to an already existing AKS cluster. |
| 107 | + |
| 108 | +```azurecli-interactive |
| 109 | +az aks nodepool add --cluster-name MyManagedCluster --name agentpool3 --resource-group MyResourceGroup --node-count 1 --host-group-id <id> --node-vm-size Standard_D2s_v3 |
| 110 | +``` |
| 111 | + |
| 112 | +## Remove a Dedicated Host Nodepool from an AKS cluster |
| 113 | + |
| 114 | +```azurecli-interactive |
| 115 | +az aks nodepool delete --cluster-name MyManagedCluster --name agentpool3 --resource-group MyResourceGroup |
| 116 | +``` |
| 117 | + |
| 118 | +## Next steps |
| 119 | + |
| 120 | +In this article, you learned how to create an AKS cluster with a Dedicated host, and to add a dedicated host to an existing cluster. For more information about Dedicated Hosts, see [dedicated-hosts](../virtual-machines/dedicated-hosts.md). |
| 121 | + |
| 122 | +<!-- LINKS - External --> |
| 123 | +[kubernetes-services]: https://kubernetes.io/docs/concepts/services-networking/service/ |
| 124 | + |
| 125 | +<!-- LINKS - Internal --> |
| 126 | +[aks-support-policies]: support-policies.md |
| 127 | +[aks-faq]: faq.md |
| 128 | +[azure-cli-install]: /cli/azure/install-azure-cli |
| 129 | +[dedicated-hosts]: /azure/virtual-machines/dedicated-hosts.md |
0 commit comments