or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

authentication-security.mdcluster-configuration.mdcluster-management.mdindex.mdnode-pool-operations.mdoperations-management.md

node-pool-operations.mddocs/

0

# Node Pool Operations

1

2

Node pool lifecycle management within Google Kubernetes Engine clusters. Node pools are groups of nodes within a cluster that share the same configuration, allowing for heterogeneous clusters with different node types and capabilities.

3

4

## Capabilities

5

6

### Listing Node Pools

7

8

Retrieve all node pools for a specified cluster.

9

10

```python { .api }

11

def list_node_pools(

12

self,

13

request=None, *,

14

project_id=None,

15

zone=None,

16

cluster_id=None,

17

parent=None,

18

retry=gapic_v1.method.DEFAULT,

19

timeout=None,

20

metadata=()

21

) -> ListNodePoolsResponse:

22

"""

23

Lists the node pools for a cluster.

24

25

Args:

26

project_id (str): Deprecated. The Google Developers Console project ID or project number.

27

zone (str): Deprecated. The name of the Google Compute Engine zone.

28

cluster_id (str): Deprecated. The name of the cluster.

29

parent (str): The parent (project, location, cluster) where the node pools will be listed.

30

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

31

retry: Retry configuration.

32

timeout (float): Request timeout in seconds.

33

metadata: Additional gRPC metadata.

34

35

Returns:

36

ListNodePoolsResponse: Response containing the list of node pools.

37

"""

38

```

39

40

Usage example:

41

42

```python

43

from google.cloud import container

44

45

client = container.ClusterManagerClient()

46

47

node_pools = client.list_node_pools(

48

project_id="my-project",

49

zone="us-central1-a",

50

cluster_id="my-cluster"

51

)

52

53

for pool in node_pools.node_pools:

54

print(f"Node pool: {pool.name}")

55

print(f"Status: {pool.status}")

56

print(f"Initial node count: {pool.initial_node_count}")

57

print(f"Machine type: {pool.config.machine_type}")

58

```

59

60

### Getting Node Pool Details

61

62

Retrieve detailed information about a specific node pool.

63

64

```python { .api }

65

def get_node_pool(

66

self,

67

request=None, *,

68

project_id=None,

69

zone=None,

70

cluster_id=None,

71

node_pool_id=None,

72

name=None,

73

retry=gapic_v1.method.DEFAULT,

74

timeout=None,

75

metadata=()

76

) -> NodePool:

77

"""

78

Retrieves the requested node pool.

79

80

Args:

81

project_id (str): Deprecated. The Google Developers Console project ID or project number.

82

zone (str): Deprecated. The name of the Google Compute Engine zone.

83

cluster_id (str): Deprecated. The name of the cluster.

84

node_pool_id (str): Deprecated. The name of the node pool.

85

name (str): The name (project, location, cluster, node pool) of the node pool to get.

86

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

87

retry: Retry configuration.

88

timeout (float): Request timeout in seconds.

89

metadata: Additional gRPC metadata.

90

91

Returns:

92

NodePool: The node pool information.

93

"""

94

```

95

96

Usage example:

97

98

```python

99

node_pool = client.get_node_pool(

100

project_id="my-project",

101

zone="us-central1-a",

102

cluster_id="my-cluster",

103

node_pool_id="default-pool"

104

)

105

106

print(f"Node pool name: {node_pool.name}")

107

print(f"Machine type: {node_pool.config.machine_type}")

108

print(f"Disk size: {node_pool.config.disk_size_gb}")

109

print(f"Node count: {node_pool.initial_node_count}")

110

```

111

112

### Creating Node Pools

113

114

Create a new node pool within an existing cluster.

115

116

```python { .api }

117

def create_node_pool(

118

self,

119

request=None, *,

120

project_id=None,

121

zone=None,

122

cluster_id=None,

123

node_pool=None,

124

parent=None,

125

retry=gapic_v1.method.DEFAULT,

126

timeout=None,

127

metadata=()

128

) -> Operation:

129

"""

130

Creates a node pool for a cluster.

131

132

Args:

133

project_id (str): Deprecated. The Google Developers Console project ID or project number.

134

zone (str): Deprecated. The name of the Google Compute Engine zone.

135

cluster_id (str): Deprecated. The name of the cluster.

136

node_pool (NodePool): Required. The node pool to create.

137

parent (str): The parent (project, location, cluster) where the node pool will be created.

138

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

139

retry: Retry configuration.

140

timeout (float): Request timeout in seconds.

141

metadata: Additional gRPC metadata.

142

143

Returns:

144

Operation: An operation representing the node pool creation.

145

"""

146

```

147

148

Usage example:

149

150

```python

151

from google.cloud.container_v1.types import NodePool, NodeConfig, NodeManagement

152

153

# Configure node pool

154

node_pool_config = NodePool(

155

name="gpu-pool",

156

initial_node_count=2,

157

config=NodeConfig(

158

machine_type="n1-standard-4",

159

disk_size_gb=100,

160

oauth_scopes=[

161

"https://www.googleapis.com/auth/cloud-platform"

162

],

163

accelerators=[

164

AcceleratorConfig(

165

accelerator_count=1,

166

accelerator_type="nvidia-tesla-k80"

167

)

168

]

169

),

170

management=NodeManagement(

171

auto_upgrade=True,

172

auto_repair=True

173

)

174

)

175

176

operation = client.create_node_pool(

177

project_id="my-project",

178

zone="us-central1-a",

179

cluster_id="my-cluster",

180

node_pool=node_pool_config

181

)

182

183

print(f"Creating node pool. Operation: {operation.name}")

184

```

185

186

### Updating Node Pools

187

188

Update an existing node pool's configuration.

189

190

```python { .api }

191

def update_node_pool(

192

self,

193

request=None, *,

194

project_id=None,

195

zone=None,

196

cluster_id=None,

197

node_pool_id=None,

198

node_version=None,

199

image_type=None,

200

name=None,

201

retry=gapic_v1.method.DEFAULT,

202

timeout=None,

203

metadata=()

204

) -> Operation:

205

"""

206

Updates the version and/or image type for the specified node pool.

207

208

Args:

209

project_id (str): Deprecated. The Google Developers Console project ID or project number.

210

zone (str): Deprecated. The name of the Google Compute Engine zone.

211

cluster_id (str): Deprecated. The name of the cluster.

212

node_pool_id (str): Deprecated. The name of the node pool.

213

node_version (str): Required. The Kubernetes version to change the nodes to.

214

image_type (str): Required. The desired image type for the node pool.

215

name (str): The name (project, location, cluster, node pool) of the node pool to update.

216

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

217

retry: Retry configuration.

218

timeout (float): Request timeout in seconds.

219

metadata: Additional gRPC metadata.

220

221

Returns:

222

Operation: An operation representing the node pool update.

223

"""

224

```

225

226

Usage example:

227

228

```python

229

operation = client.update_node_pool(

230

project_id="my-project",

231

zone="us-central1-a",

232

cluster_id="my-cluster",

233

node_pool_id="default-pool",

234

node_version="1.21.14-gke.700",

235

image_type="COS_CONTAINERD"

236

)

237

238

print(f"Updating node pool. Operation: {operation.name}")

239

```

240

241

### Deleting Node Pools

242

243

Delete an existing node pool from a cluster.

244

245

```python { .api }

246

def delete_node_pool(

247

self,

248

request=None, *,

249

project_id=None,

250

zone=None,

251

cluster_id=None,

252

node_pool_id=None,

253

name=None,

254

retry=gapic_v1.method.DEFAULT,

255

timeout=None,

256

metadata=()

257

) -> Operation:

258

"""

259

Deletes a node pool from a cluster.

260

261

Args:

262

project_id (str): Deprecated. The Google Developers Console project ID or project number.

263

zone (str): Deprecated. The name of the Google Compute Engine zone.

264

cluster_id (str): Deprecated. The name of the cluster.

265

node_pool_id (str): Deprecated. The name of the node pool to delete.

266

name (str): The name (project, location, cluster, node pool) of the node pool to delete.

267

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

268

retry: Retry configuration.

269

timeout (float): Request timeout in seconds.

270

metadata: Additional gRPC metadata.

271

272

Returns:

273

Operation: An operation representing the node pool deletion.

274

"""

275

```

276

277

### Node Pool Autoscaling

278

279

Configure autoscaling settings for a node pool.

280

281

```python { .api }

282

def set_node_pool_autoscaling(

283

self,

284

request=None, *,

285

project_id=None,

286

zone=None,

287

cluster_id=None,

288

node_pool_id=None,

289

autoscaling=None,

290

name=None,

291

retry=gapic_v1.method.DEFAULT,

292

timeout=None,

293

metadata=()

294

) -> Operation:

295

"""

296

Sets the autoscaling settings for the specified node pool.

297

298

Args:

299

project_id (str): Deprecated. The Google Developers Console project ID or project number.

300

zone (str): Deprecated. The name of the Google Compute Engine zone.

301

cluster_id (str): Deprecated. The name of the cluster.

302

node_pool_id (str): Deprecated. The name of the node pool.

303

autoscaling (NodePoolAutoscaling): Required. Autoscaling configuration for the node pool.

304

name (str): The name (project, location, cluster, node pool) of the node pool to set autoscaling for.

305

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

306

retry: Retry configuration.

307

timeout (float): Request timeout in seconds.

308

metadata: Additional gRPC metadata.

309

310

Returns:

311

Operation: An operation representing the autoscaling configuration.

312

"""

313

```

314

315

Usage example:

316

317

```python

318

from google.cloud.container_v1.types import NodePoolAutoscaling

319

320

autoscaling_config = NodePoolAutoscaling(

321

enabled=True,

322

min_node_count=1,

323

max_node_count=10,

324

total_min_node_count=1,

325

total_max_node_count=100

326

)

327

328

operation = client.set_node_pool_autoscaling(

329

project_id="my-project",

330

zone="us-central1-a",

331

cluster_id="my-cluster",

332

node_pool_id="default-pool",

333

autoscaling=autoscaling_config

334

)

335

```

336

337

### Node Pool Management

338

339

Configure management settings for a node pool.

340

341

```python { .api }

342

def set_node_pool_management(

343

self,

344

request=None, *,

345

project_id=None,

346

zone=None,

347

cluster_id=None,

348

node_pool_id=None,

349

management=None,

350

name=None,

351

retry=gapic_v1.method.DEFAULT,

352

timeout=None,

353

metadata=()

354

) -> Operation:

355

"""

356

Sets the NodeManagement options for a node pool.

357

358

Args:

359

project_id (str): Deprecated. The Google Developers Console project ID or project number.

360

zone (str): Deprecated. The name of the Google Compute Engine zone.

361

cluster_id (str): Deprecated. The name of the cluster.

362

node_pool_id (str): Deprecated. The name of the node pool.

363

management (NodeManagement): Required. NodeManagement configuration for the node pool.

364

name (str): The name (project, location, cluster, node pool) of the node pool to set management properties.

365

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

366

retry: Retry configuration.

367

timeout (float): Request timeout in seconds.

368

metadata: Additional gRPC metadata.

369

370

Returns:

371

Operation: An operation representing the management configuration.

372

"""

373

```

374

375

Usage example:

376

377

```python

378

from google.cloud.container_v1.types import NodeManagement, AutoUpgradeOptions

379

380

management_config = NodeManagement(

381

auto_upgrade=True,

382

auto_repair=True,

383

upgrade_options=AutoUpgradeOptions(

384

auto_upgrade_start_time="2023-01-01T02:00:00Z",

385

description="Weekly maintenance window"

386

)

387

)

388

389

operation = client.set_node_pool_management(

390

project_id="my-project",

391

zone="us-central1-a",

392

cluster_id="my-cluster",

393

node_pool_id="default-pool",

394

management=management_config

395

)

396

```

397

398

### Node Pool Size

399

400

Set the size of a node pool.

401

402

```python { .api }

403

def set_node_pool_size(

404

self,

405

request=None, *,

406

project_id=None,

407

zone=None,

408

cluster_id=None,

409

node_pool_id=None,

410

node_count=None,

411

name=None,

412

retry=gapic_v1.method.DEFAULT,

413

timeout=None,

414

metadata=()

415

) -> Operation:

416

"""

417

Sets the size for a specific node pool.

418

419

Args:

420

project_id (str): Deprecated. The Google Developers Console project ID or project number.

421

zone (str): Deprecated. The name of the Google Compute Engine zone.

422

cluster_id (str): Deprecated. The name of the cluster.

423

node_pool_id (str): Deprecated. The name of the node pool.

424

node_count (int): Required. The desired node count for the pool.

425

name (str): The name (project, location, cluster, node pool) of the node pool to set size.

426

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

427

retry: Retry configuration.

428

timeout (float): Request timeout in seconds.

429

metadata: Additional gRPC metadata.

430

431

Returns:

432

Operation: An operation representing the size change.

433

"""

434

```

435

436

### Node Pool Upgrade Operations

437

438

Complete or rollback node pool upgrades.

439

440

```python { .api }

441

def complete_node_pool_upgrade(

442

self,

443

request=None, *,

444

name=None,

445

retry=gapic_v1.method.DEFAULT,

446

timeout=None,

447

metadata=()

448

) -> None:

449

"""

450

CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.

451

452

Args:

453

name (str): The name (project, location, cluster, node pool) of the node pool to complete upgrade.

454

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

455

retry: Retry configuration.

456

timeout (float): Request timeout in seconds.

457

metadata: Additional gRPC metadata.

458

"""

459

460

def rollback_node_pool_upgrade(

461

self,

462

request=None, *,

463

project_id=None,

464

zone=None,

465

cluster_id=None,

466

node_pool_id=None,

467

name=None,

468

retry=gapic_v1.method.DEFAULT,

469

timeout=None,

470

metadata=()

471

) -> Operation:

472

"""

473

Rolls back a previously Aborted or Failed NodePool upgrade.

474

475

Args:

476

project_id (str): Deprecated. The Google Developers Console project ID or project number.

477

zone (str): Deprecated. The name of the Google Compute Engine zone.

478

cluster_id (str): Deprecated. The name of the cluster.

479

node_pool_id (str): Deprecated. The name of the node pool.

480

name (str): The name (project, location, cluster, node pool) of the node pool to rollback.

481

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}/nodePools/{node_pool_id}

482

retry: Retry configuration.

483

timeout (float): Request timeout in seconds.

484

metadata: Additional gRPC metadata.

485

486

Returns:

487

Operation: An operation representing the rollback.

488

"""

489

```

490

491

## Types

492

493

```python { .api }

494

class ListNodePoolsRequest:

495

"""ListNodePoolsRequest lists the node pools for a cluster."""

496

project_id: str # Deprecated

497

zone: str # Deprecated

498

cluster_id: str # Deprecated

499

parent: str # Required. Format: projects/{project}/locations/{location}/clusters/{cluster}

500

501

class ListNodePoolsResponse:

502

"""ListNodePoolsResponse is the result of ListNodePoolsRequest."""

503

node_pools: MutableSequence[NodePool]

504

505

class GetNodePoolRequest:

506

"""GetNodePoolRequest retrieves a node pool for a cluster."""

507

project_id: str # Deprecated

508

zone: str # Deprecated

509

cluster_id: str # Deprecated

510

node_pool_id: str # Deprecated

511

name: str # Required. Format: projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}

512

513

class CreateNodePoolRequest:

514

"""CreateNodePoolRequest creates a node pool for a cluster."""

515

project_id: str # Deprecated

516

zone: str # Deprecated

517

cluster_id: str # Deprecated

518

node_pool: NodePool # Required

519

parent: str # Required. Format: projects/{project}/locations/{location}/clusters/{cluster}

520

521

class DeleteNodePoolRequest:

522

"""DeleteNodePoolRequest deletes a node pool for a cluster."""

523

project_id: str # Deprecated

524

zone: str # Deprecated

525

cluster_id: str # Deprecated

526

node_pool_id: str # Deprecated

527

name: str # Required. Format: projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}

528

529

class UpdateNodePoolRequest:

530

"""UpdateNodePoolRequest updates a node pool for a cluster."""

531

project_id: str # Deprecated

532

zone: str # Deprecated

533

cluster_id: str # Deprecated

534

node_pool_id: str # Deprecated

535

node_version: str # Required

536

image_type: str # Required

537

name: str # Required

538

539

class SetNodePoolAutoscalingRequest:

540

"""SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool."""

541

project_id: str # Deprecated

542

zone: str # Deprecated

543

cluster_id: str # Deprecated

544

node_pool_id: str # Deprecated

545

autoscaling: NodePoolAutoscaling # Required

546

name: str # Required

547

548

class SetNodePoolManagementRequest:

549

"""SetNodePoolManagementRequest sets the node management properties of a node pool."""

550

project_id: str # Deprecated

551

zone: str # Deprecated

552

cluster_id: str # Deprecated

553

node_pool_id: str # Deprecated

554

management: NodeManagement # Required

555

name: str # Required

556

557

class SetNodePoolSizeRequest:

558

"""SetNodePoolSizeRequest sets the size of a node pool."""

559

project_id: str # Deprecated

560

zone: str # Deprecated

561

cluster_id: str # Deprecated

562

node_pool_id: str # Deprecated

563

node_count: int # Required

564

name: str # Required

565

566

class NodePoolAutoscaling:

567

"""NodePoolAutoscaling contains information required by cluster autoscaler."""

568

enabled: bool

569

min_node_count: int

570

max_node_count: int

571

total_min_node_count: int

572

total_max_node_count: int

573

location_policy: NodePoolAutoscaling.LocationPolicy

574

575

class NodeManagement:

576

"""NodeManagement defines the set of node management services."""

577

auto_upgrade: bool

578

auto_repair: bool

579

upgrade_options: AutoUpgradeOptions

580

581

class AutoUpgradeOptions:

582

"""AutoUpgradeOptions defines the set of options for the user to control how the Auto Upgrades will proceed."""

583

auto_upgrade_start_time: str

584

description: str

585

```