Skip to content

Commit fae9b16

Browse files
author
Larry Franks
committed
updates for AKS cluster_purpose parameter
1 parent 041a7c5 commit fae9b16

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

articles/machine-learning/service/how-to-deploy-and-where.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: conceptual
99
ms.author: jordane
1010
author: jpe316
1111
ms.reviewer: larryfr
12-
ms.date: 05/21/2019
12+
ms.date: 05/31/2019
1313

1414
ms.custom: seoapril2019
1515
---
@@ -277,7 +277,7 @@ To see quota and region availability for ACI, see the [Quotas and region availab
277277

278278
For more information, see the reference documentation for the [AciWebservice](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.aciwebservice?view=azure-ml-py) and [Webservice](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.webservice?view=azure-ml-py) classes.
279279

280-
### <a id="aks"></a>Azure Kubernetes Service (PRODUCTION)
280+
### <a id="aks"></a>Azure Kubernetes Service (DEVTEST & PRODUCTION)
281281

282282
You can use an existing AKS cluster or create a new one using the Azure Machine Learning SDK, CLI, or the Azure portal.
283283

@@ -289,6 +289,7 @@ If you already have an AKS cluster attached, you can deploy to it. If you haven'
289289

290290
```python
291291
aks_target = AksCompute(ws,"myaks")
292+
# If deploying to a cluster configured for dev/test, we recommend setting cpu_cores = 2.
292293
deployment_config = AksWebservice.deploy_configuration(cpu_cores = 1, memory_gb = 1)
293294
service = Model.deploy(ws, "aksservice", [model], inference_config, deployment_config, aks_target)
294295
service.wait_for_deployment(show_output = True)
@@ -311,16 +312,21 @@ Learn more about AKS deployment and autoscale in the [AksWebservice.deploy_confi
311312
#### Create a new AKS cluster<a id="create-attach-aks"></a>
312313
**Time estimate:** Approximately 5 minutes.
313314

315+
Creating or attaching an AKS cluster is a one time process for your workspace. You can reuse this cluster for multiple deployments. If you delete the cluster or the resource group that contains it, you must create a new cluster the next time you need to deploy. You can have multiple AKS clusters attached to your workspace.
316+
317+
If you want to create an AKS cluster for development, validation, and testing, you set `cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST` when using [`provisioning_configuration()`](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.akscompute?view=azure-ml-py). A cluster created with this setting will only have one node.
318+
314319
> [!IMPORTANT]
315-
> Creating or attaching an AKS cluster is a one time process for your workspace. You can reuse this cluster for multiple deployments. If you delete the cluster or the resource group that contains it, you must create a new cluster the next time you need to deploy.
320+
> Setting `cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST` creates an AKS cluster that is not suitable for handling production traffic, and may increase inference times for the deployed model. When deploying a model to a devtest cluster, Microsoft recommends configuring 2 cores.
316321
317-
For more information on setting `autoscale_target_utilization`, `autoscale_max_replicas`, and `autoscale_min_replicas`, see the [AksWebservice.deploy_configuration](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.akswebservice?view=azure-ml-py#deploy-configuration-autoscale-enabled-none--autoscale-min-replicas-none--autoscale-max-replicas-none--autoscale-refresh-seconds-none--autoscale-target-utilization-none--collect-model-data-none--auth-enabled-none--cpu-cores-none--memory-gb-none--enable-app-insights-none--scoring-timeout-ms-none--replica-max-concurrent-requests-none--max-request-wait-time-none--num-replicas-none--primary-key-none--secondary-key-none--tags-none--properties-none--description-none-) reference.
318322
The following example demonstrates how to create a new Azure Kubernetes Service cluster:
319323

320324
```python
321325
from azureml.core.compute import AksCompute, ComputeTarget
322326

323-
# Use the default configuration (you can also provide parameters to customize this)
327+
# Use the default configuration (you can also provide parameters to customize this).
328+
# For example, to create a dev/test cluster, use:
329+
# prov_config = AksCompute.provisioning_configuration(cluster_purpose = AksComputee.ClusterPurpose.DEV_TEST)
324330
prov_config = AksCompute.provisioning_configuration()
325331

326332
aks_name = 'myaks'
@@ -337,23 +343,34 @@ For more information on creating an AKS cluster outside of the Azure Machine Lea
337343
* [Create an AKS cluster](https://docs.microsoft.com/cli/azure/aks?toc=%2Fazure%2Faks%2FTOC.json&bc=%2Fazure%2Fbread%2Ftoc.json&view=azure-cli-latest#az-aks-create)
338344
* [Create an AKS cluster (portal)](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal?view=azure-cli-latest)
339345

340-
341346
> [!IMPORTANT]
342347
> For [`provisioning_configuration()`](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.akscompute?view=azure-ml-py), if you pick custom values for agent_count and vm_size, then you need to make sure agent_count multiplied by vm_size is greater than or equal to 12 virtual CPUs. For example, if you use a vm_size of "Standard_D3_v2", which has 4 virtual CPUs, then you should pick an agent_count of 3 or greater.
343348
344349
**Time estimate**: Approximately 20 minutes.
345350

346351
#### Attach an existing AKS cluster
347352

348-
If you already have AKS cluster in your Azure subscription, and it is version 1.12.## and has at least 12 virtual CPUs, you can use it to deploy your image. The following code demonstrates how to attach an existing AKS 1.12.## cluster to your workspace:
353+
If you already have AKS cluster in your Azure subscription, and it is version 1.12.##, you can use it to deploy your image.
354+
355+
> [!WARNING]
356+
> When attaching an AKS cluster to a workspace, you can define how you will use the cluster by setting the `cluster_purpose` parameter.
357+
>
358+
> If you do not set the `cluster_purpose` parameter, or set `cluster_purpose = AksCompute.ClusterPurpose.FAST_PROD`, then the cluster must have at least 12 virtual CPUs available.
359+
>
360+
> If you set `cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST`, then the cluster does not need to have 12 virtual CPUs. However a cluster that is configured for dev/test will not be suitable for production level traffic and may increase inference times.
361+
362+
The following code demonstrates how to attach an existing AKS 1.12.## cluster to your workspace:
349363

350364
```python
351365
from azureml.core.compute import AksCompute, ComputeTarget
352366
# Set the resource group that contains the AKS cluster and the cluster name
353367
resource_group = 'myresourcegroup'
354368
cluster_name = 'mycluster'
355369

356-
# Attach the cluster to your workgroup
370+
# Attach the cluster to your workgroup. If the cluster has less than 12 virtual CPUs, use the following instead:
371+
# attach_config = AksCompute.attach_configuration(resource_group = resource_group,
372+
# cluster_name = cluster_name,
373+
# cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST)
357374
attach_config = AksCompute.attach_configuration(resource_group = resource_group,
358375
cluster_name = cluster_name)
359376
aks_target = ComputeTarget.attach(ws, 'mycompute', attach_config)

0 commit comments

Comments
 (0)