Skip to content

Commit 3cb2773

Browse files
committed
draft
1 parent e053f00 commit 3cb2773

File tree

1 file changed

+183
-0
lines changed

1 file changed

+183
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
title: Use dedicated pool to run task - Tasks
3+
description: Use a dedicated compute pool (agent pool) to run an Azure Container Registry task.
4+
ms.topic: article
5+
ms.date: 04/30/2020
6+
---
7+
8+
# Run an ACR task on a dedicated agent pool
9+
10+
Set up an Azure-managed VM pool (*agent pool*) to enable running your [Azure Container Registry tasks][acr-tasks] in a dedicated compute environment. After you've configured one or more pools in your registry, you can choose a pool to run a task in place of the service's default compute environment.
11+
12+
An agent pool provides:
13+
14+
- **Virtual network support** - Assign an agent pool to an Azure VNet, providing access to resources in the VNet such as a container registry, key vault, or storage.
15+
- **Scale as needed** - Increase the number of instances in an agent pool for compute-intensive tasks, or scale to zero. Billing is based on allocation.
16+
- **Flexible options** - Choose from different [pool tiers][#pool-tiers] and scale options to meet your task workload needs.
17+
- **Azure management** - Task pools are patched and maintained by Azure, providing reserved allocation without the need to maintain the individual VMs.
18+
19+
This feature is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs][acr-tiers].
20+
21+
> [!IMPORTANT]
22+
> This feature is currently in preview, and some [limitations apply](#preview-limitations). Previews are made available to you on the condition that you agree to the [supplemental terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
23+
>
24+
25+
## Preview limitations
26+
27+
- Task agent pools currently support Linux nodes. Windows nodes are not currently supported.
28+
- Task agent pools are available in preview in the following regions: West US 2, South Central US, East US 2, and East US.
29+
- For each registry, the default total vCPU (core) quota for all agent pools is 16. Please [open a support ticket][open-support-ticket] for additional allocation.
30+
31+
32+
## Prerequisites
33+
34+
* To use the Azure CLI steps in this article, Azure CLI version 2.3.1 or later is required. If you need to install or upgrade, see [Install Azure CLI][azure-cli]. Or run in [Azure Cloud Shell](../cloud-shell/quickstart.md).
35+
* If you don't already have a container registry, [create one][create-reg-cli](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli) (Premium tier required) in a preview region.
36+
37+
## Pool tiers
38+
39+
The following table shows the resources per instance in the agent pool tiers.
40+
41+
|Tier |CPU |Memory (GB) |
42+
|---------|---------|---------|
43+
|S1 | 2 | 3 |
44+
|S2 | 4 | 8 |
45+
|S3 | 8 | 16 |
46+
47+
## Create and manage a task agent pool
48+
49+
### Set default registry (optional)
50+
51+
To simplify Azure CLI commands that follow, set the default registry by running the [az configure][az-configure] command:
52+
53+
```azurecli
54+
az configure --defaults acr=<registryName>
55+
```
56+
57+
The following examples assume that you've set the default registry. If not, pass a `--registry <registryName>` parameter in each `az acr` command.
58+
59+
### Create agent pool
60+
61+
Create an agent pool by using the [az acr agentpool create][az-acr-agentpool-create] command. The following example creates a tier S2 pool (4 CPU/instance). By default, the pool contains 1 instance.
62+
63+
```azurecli
64+
az acr agentpool create \
65+
--name myagentpool \
66+
--tier S2
67+
```
68+
69+
Creating an agent pool and other pool operations can take several minutes to complete.
70+
71+
### Scale pool
72+
73+
Scale the pool size up or down with the [az acr agentpool update][az-acr-agentpool-update] command. The following example scales the pool to 2 instances. You can scale to 0 instances.
74+
75+
```azurecli
76+
az acr agentpool update \
77+
--name myagentpool \
78+
--count 2
79+
```
80+
81+
## Create pool in a virtual network
82+
83+
### Add firewall rules
84+
85+
Task agent pools require access to the following Azure services. The following firewall rules must be added to any existing network security groups or user-defined routes.
86+
87+
| Direction | Protocol | Source | Source Port | Destination | Dest Port | Used |
88+
|-----------|----------|----------------|-------------|----------------------|-----------|---------|
89+
| Outbound | TCP | VirtualNetwork | Any | Storage | 443 | Default |
90+
| Outbound | TCP | VirtualNetwork | Any | EventHub | 443 | Default |
91+
| Outbound | TCP | VirtualNetwork | Any | AzureActiveDirectory | 443 | Default |
92+
| Outbound | TCP | VirtualNetwork | Any | AzureMonitor | 443 | Default |
93+
94+
> [!NOTE]
95+
> If your tasks require additional resources from public internet, add the corresponding rules. For example, these rules are needed if you run a docker build task that needs to pull the base images from Docker Hub, or restores a NuGet package.
96+
97+
### Create pool in VNet
98+
99+
The following example creates an agent pool in the *mysubnet* subnet of network *myvnet*:
100+
101+
```azurecli
102+
subnet=$(az network vnet subnet show \
103+
--resource-grop myresourcegroup \
104+
--vnet-name myvnet \
105+
--name mysubnetname \
106+
--query id --output tsv)
107+
108+
az acr agentpool create \
109+
--name myagentpool \
110+
--tier S2 \
111+
--subnet-id $subnet
112+
```
113+
114+
## Run tasks on agent pool
115+
116+
The following sections show how to specify an agent pool when queuing a task.
117+
118+
> [!NOTE]
119+
> To use an agent pool in an ACR Task, ensure that the pool contains at least 1 instance.
120+
>
121+
122+
### Quick task run
123+
124+
Queue a quick run on the agent pool by using the [az acr build][az-acr-build] command and pass the `--agent-pool` parameter:
125+
126+
```azurecli
127+
az acr build \
128+
--agent-pool myagentpool \
129+
--image myimage:mytag \
130+
--file Dockerfile \
131+
https://github.com/Azure-Samples/acr-build-helloworld-node.git
132+
```
133+
134+
### Automatically triggered task
135+
136+
For example, create a scheduled task on the agent pool with [az acr task create][az-acr-task-create].
137+
138+
```azurecli
139+
az acr task create \
140+
--name mytask \
141+
--agent-pool myagentpool \
142+
--image myimage:mytag \
143+
--schedule "0 21 * * *" \
144+
--file Dockerfile \
145+
--context https://github.com/Azure-Samples/acr-build-helloworld-node.git \
146+
--commit-trigger-enabled false
147+
```
148+
149+
To verify task setup, run [az acr task run][az-acr-task-run]:
150+
151+
```azurecli
152+
az acr task run \
153+
--name mytask
154+
```
155+
156+
### Query pool status
157+
158+
Query the agent pool queue status (current scheduled runs on the agent pool) by running [az acr agentpool show][az-acr-agentpool-show].
159+
160+
```azurecli
161+
az acr agentpool show \
162+
--name myagentpool \
163+
--queue-count
164+
```
165+
166+
## Next steps
167+
168+
For more examples of container image builds and maintenance in the cloud, check out the [ACR Tasks tutorial series](container-registry-tutorial-quick-task.md).
169+
170+
171+
172+
[acr-tasks]: container-registry-tasks-overview.md
173+
[acr-tiers]: container-registry-skus.md
174+
[azure-cli]: /cli/azure/install-azure-cli
175+
[open-support-ticket]: https://aka.ms/acr/support/create-ticket
176+
[terms-of-use]: https://azure.microsoft.com/support/legal/preview-supplemental-terms/
177+
[az-configure]: /cli/azure#az-configure
178+
[az-acr-agentpool-create]: /cli/azure/acr/agentpool#az-acr-agentpool-create
179+
[az-acr-agentpool-update]: /cli/azure/acr/agentpool#az-acr-agentpool-update
180+
[az-acr-agentpool-show]: /cli/azure/acr/agentpool#az-acr-agentpool-show
181+
[az-acr-build]: /cli/azure/acr#az-acr-build
182+
[az-acr-task-create]: /cli/azure/acr/task#az-acr-task-create
183+
[create-reg-cli]: container-registry-get-started-azure-cli.md

0 commit comments

Comments
 (0)