or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

agent-pools.mdindex.mdmachines.mdmaintenance.mdmanaged-clusters.mdmodels.mdprivate-endpoints.mdsnapshots.mdtrusted-access.md

agent-pools.mddocs/

0

# Agent Pool Operations

1

2

Node pool management operations for AKS clusters including system and user node pools, auto-scaling configuration, OS and VM size selection, and maintenance operations. Agent pools represent groups of nodes with identical configurations within a managed cluster.

3

4

## Capabilities

5

6

### Agent Pool Retrieval

7

8

Get information about existing agent pools in an AKS cluster.

9

10

```python { .api }

11

def get(

12

resource_group_name: str,

13

resource_name: str,

14

agent_pool_name: str,

15

**kwargs

16

) -> AgentPool:

17

"""

18

Get the specified agent pool.

19

20

Parameters:

21

- resource_group_name (str): The name of the resource group

22

- resource_name (str): The name of the managed cluster

23

- agent_pool_name (str): The name of the agent pool

24

25

Returns:

26

AgentPool: The agent pool resource

27

"""

28

```

29

30

Usage example:

31

32

```python

33

agent_pool = client.agent_pools.get("my-rg", "my-cluster", "nodepool1")

34

print(f"Node count: {agent_pool.count}")

35

print(f"VM size: {agent_pool.vm_size}")

36

print(f"OS type: {agent_pool.os_type}")

37

```

38

39

### Agent Pool Creation and Updates

40

41

Create new agent pools or update existing ones with comprehensive configuration options.

42

43

```python { .api }

44

def begin_create_or_update(

45

resource_group_name: str,

46

resource_name: str,

47

agent_pool_name: str,

48

parameters: AgentPool,

49

**kwargs

50

) -> LROPoller[AgentPool]:

51

"""

52

Create or update an agent pool.

53

54

Parameters:

55

- resource_group_name (str): The name of the resource group

56

- resource_name (str): The name of the managed cluster

57

- agent_pool_name (str): The name of the agent pool

58

- parameters (AgentPool): The agent pool specification

59

60

Returns:

61

LROPoller[AgentPool]: Long-running operation poller

62

"""

63

```

64

65

Usage example:

66

67

```python

68

from azure.mgmt.containerservice.models import AgentPool, AgentPoolUpgradeSettings

69

70

# Create agent pool configuration

71

agent_pool_config = AgentPool(

72

count=3,

73

vm_size="Standard_D4s_v3",

74

os_type="Linux",

75

mode="User",

76

max_pods=110,

77

enable_auto_scaling=True,

78

min_count=1,

79

max_count=10,

80

upgrade_settings=AgentPoolUpgradeSettings(

81

max_surge="1"

82

),

83

node_labels={"environment": "production"},

84

node_taints=["workload=gpu:NoSchedule"]

85

)

86

87

# Create agent pool

88

operation = client.agent_pools.create_or_update(

89

"my-rg", "my-cluster", "gpu-pool", agent_pool_config

90

)

91

agent_pool = operation.result()

92

print(f"Agent pool created: {agent_pool.name}")

93

```

94

95

### Agent Pool Listing

96

97

List all agent pools in a managed cluster.

98

99

```python { .api }

100

def list(

101

resource_group_name: str,

102

resource_name: str,

103

**kwargs

104

) -> ItemPaged[AgentPool]:

105

"""

106

Get a list of agent pools in the specified managed cluster.

107

108

Parameters:

109

- resource_group_name (str): The name of the resource group

110

- resource_name (str): The name of the managed cluster

111

112

Returns:

113

ItemPaged[AgentPool]: Paginated list of agent pools

114

"""

115

```

116

117

### Agent Pool Deletion

118

119

Delete agent pools from AKS clusters.

120

121

```python { .api }

122

def begin_delete(

123

resource_group_name: str,

124

resource_name: str,

125

agent_pool_name: str,

126

ignore_pod_disruption_budget: bool = None,

127

**kwargs

128

) -> LROPoller[None]:

129

"""

130

Delete an agent pool.

131

132

Parameters:

133

- resource_group_name (str): The name of the resource group

134

- resource_name (str): The name of the managed cluster

135

- agent_pool_name (str): The name of the agent pool

136

- ignore_pod_disruption_budget (bool): Ignore PodDisruptionBudget during deletion

137

138

Returns:

139

LROPoller[None]: Long-running operation poller

140

"""

141

```

142

143

### Agent Pool Upgrade Operations

144

145

Manage agent pool upgrades and get available versions.

146

147

```python { .api }

148

def get_available_agent_pool_versions(

149

resource_group_name: str,

150

resource_name: str,

151

**kwargs

152

) -> AgentPoolAvailableVersions:

153

"""

154

Get available upgrade versions for agent pools.

155

156

Parameters:

157

- resource_group_name (str): The name of the resource group

158

- resource_name (str): The name of the managed cluster

159

160

Returns:

161

AgentPoolAvailableVersions: Available versions for agent pools

162

"""

163

164

def get_upgrade_profile(

165

resource_group_name: str,

166

resource_name: str,

167

agent_pool_name: str,

168

**kwargs

169

) -> AgentPoolUpgradeProfile:

170

"""

171

Get upgrade profile for an agent pool.

172

173

Parameters:

174

- resource_group_name (str): The name of the resource group

175

- resource_name (str): The name of the managed cluster

176

- agent_pool_name (str): The name of the agent pool

177

178

Returns:

179

AgentPoolUpgradeProfile: Upgrade profile with available versions

180

"""

181

```

182

183

### Machine Management

184

185

Manage individual machines within agent pools.

186

187

```python { .api }

188

def delete_machines(

189

resource_group_name: str,

190

resource_name: str,

191

agent_pool_name: str,

192

machine_names: AgentPoolDeleteMachinesParameter,

193

**kwargs

194

) -> LROPoller[None]:

195

"""

196

Delete specific machines from an agent pool.

197

198

Parameters:

199

- resource_group_name (str): The name of the resource group

200

- resource_name (str): The name of the managed cluster

201

- agent_pool_name (str): The name of the agent pool

202

- machine_names (AgentPoolDeleteMachinesParameter): Machine names to delete

203

204

Returns:

205

LROPoller[None]: Long-running operation poller

206

"""

207

```

208

209

## Types

210

211

### AgentPool

212

213

```python { .api }

214

class AgentPool:

215

"""

216

Agent pool resource representing a group of nodes.

217

218

Attributes:

219

- count (int): Number of nodes in the agent pool

220

- vm_size (str): VM size for nodes (e.g., Standard_D2s_v3)

221

- os_disk_size_gb (int): OS disk size in GB

222

- os_type (str): OS type (Linux, Windows)

223

- max_pods (int): Maximum pods per node

224

- type (str): Agent pool type (VirtualMachineScaleSets, AvailabilitySet)

225

- mode (str): Agent pool mode (System, User)

226

- orchestrator_version (str): Kubernetes version

227

- provisioning_state (str): Provisioning state

228

- power_state (PowerState): Current power state

229

- availability_zones (List[str]): Availability zones

230

- enable_auto_scaling (bool): Enable auto-scaling

231

- min_count (int): Minimum node count (when auto-scaling enabled)

232

- max_count (int): Maximum node count (when auto-scaling enabled)

233

- enable_node_public_ip (bool): Enable public IP on nodes

234

- scale_down_mode (str): Scale down mode (Delete, Deallocate)

235

- spot_max_price (float): Max price for spot instances

236

- tags (Dict[str, str]): Resource tags

237

- node_labels (Dict[str, str]): Kubernetes node labels

238

- node_taints (List[str]): Kubernetes node taints

239

- proximity_placement_group_id (str): Proximity placement group ID

240

- upgrade_settings (AgentPoolUpgradeSettings): Upgrade settings

241

- enable_encryption_at_host (bool): Enable encryption at host

242

- enable_ultra_ssd (bool): Enable Ultra SSD

243

- gpu_instance_profile (str): GPU instance profile

244

- workload_runtime (str): Workload runtime (OCIContainer, WasmWasi)

245

- network_profile (AgentPoolNetworkProfile): Network configuration

246

- windows_profile (AgentPoolWindowsProfile): Windows-specific configuration

247

"""

248

```

249

250

### AgentPoolUpgradeSettings

251

252

```python { .api }

253

class AgentPoolUpgradeSettings:

254

"""

255

Agent pool upgrade settings.

256

257

Attributes:

258

- max_surge (str): Maximum number of nodes that can be created during upgrade

259

- drain_timeout_in_minutes (int): Drain timeout in minutes

260

- node_soak_duration_in_minutes (int): Node soak duration in minutes

261

"""

262

```

263

264

### AgentPoolDeleteMachinesParameter

265

266

```python { .api }

267

class AgentPoolDeleteMachinesParameter:

268

"""

269

Parameters for deleting specific machines from an agent pool.

270

271

Attributes:

272

- machine_names (List[str]): List of machine names to delete

273

"""

274

```

275

276

## Agent Pool Modes

277

278

Agent pools can operate in two modes:

279

280

- **System**: Required for system pods and cluster functionality. Must have at least one system pool.

281

- **User**: For application workloads. Can be scaled to zero or deleted.

282

283

## Auto-scaling Configuration

284

285

Configure horizontal pod autoscaler for dynamic node scaling:

286

287

```python

288

agent_pool = AgentPool(

289

count=3, # Initial count

290

enable_auto_scaling=True,

291

min_count=1, # Minimum nodes

292

max_count=10, # Maximum nodes

293

vm_size="Standard_D2s_v3"

294

)

295

```

296

297

## Async Operations

298

299

All operations have async equivalents:

300

301

```python

302

from azure.mgmt.containerservice.aio import ContainerServiceClient

303

304

async with ContainerServiceClient(credential, subscription_id) as client:

305

agent_pool = await client.agent_pools.get("my-rg", "my-cluster", "nodepool1")

306

307

# Long-running operations

308

operation = await client.agent_pools.begin_create_or_update(

309

"my-rg", "my-cluster", "new-pool", agent_pool_config

310

)

311

result = await operation.result()

312

```