Kubernetes Cluster Node Pool
Manages a Node Pool within a Kubernetes Cluster
NOTE: Multiple Node Pools are only supported when the Kubernetes Cluster is using Virtual Machine Scale Sets. Note: Changing certain properties is done by cycling the node pool. When cycling it, it doesn’t perform cordon and drain, and it will disrupt rescheduling pods currently running on the previous node pool.
temporary_name_for_rotation
must be specified when changing any of the following properties:fips_enabled
,host_encryption_enabled
,kubelet_config
,kubelet_disk_type
,linux_os_config
,max_pods
,node_public_ip_enabled
,os_disk_size_gb
,os_disk_type
,pod_subnet_id
,snapshot_id
,ultra_ssd_enabled
,vm_size
,vnet_subnet_id
,zones
.
Example Usage
This example provisions a basic Kubernetes Node Pool.
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const exampleKubernetesCluster = new azure.containerservice.KubernetesCluster("example", {
name: "example-aks1",
location: example.location,
resourceGroupName: example.name,
dnsPrefix: "exampleaks1",
defaultNodePool: {
name: "default",
nodeCount: 1,
vmSize: "Standard_D2_v2",
},
servicePrincipal: {
clientId: "00000000-0000-0000-0000-000000000000",
clientSecret: "00000000000000000000000000000000",
},
});
const exampleKubernetesClusterNodePool = new azure.containerservice.KubernetesClusterNodePool("example", {
name: "internal",
kubernetesClusterId: exampleKubernetesCluster.id,
vmSize: "Standard_DS2_v2",
nodeCount: 1,
tags: {
Environment: "Production",
},
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_kubernetes_cluster = azure.containerservice.KubernetesCluster("example",
name="example-aks1",
location=example.location,
resource_group_name=example.name,
dns_prefix="exampleaks1",
default_node_pool={
"name": "default",
"node_count": 1,
"vm_size": "Standard_D2_v2",
},
service_principal={
"client_id": "00000000-0000-0000-0000-000000000000",
"client_secret": "00000000000000000000000000000000",
})
example_kubernetes_cluster_node_pool = azure.containerservice.KubernetesClusterNodePool("example",
name="internal",
kubernetes_cluster_id=example_kubernetes_cluster.id,
vm_size="Standard_DS2_v2",
node_count=1,
tags={
"Environment": "Production",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var exampleKubernetesCluster = new Azure.ContainerService.KubernetesCluster("example", new()
{
Name = "example-aks1",
Location = example.Location,
ResourceGroupName = example.Name,
DnsPrefix = "exampleaks1",
DefaultNodePool = new Azure.ContainerService.Inputs.KubernetesClusterDefaultNodePoolArgs
{
Name = "default",
NodeCount = 1,
VmSize = "Standard_D2_v2",
},
ServicePrincipal = new Azure.ContainerService.Inputs.KubernetesClusterServicePrincipalArgs
{
ClientId = "00000000-0000-0000-0000-000000000000",
ClientSecret = "00000000000000000000000000000000",
},
});
var exampleKubernetesClusterNodePool = new Azure.ContainerService.KubernetesClusterNodePool("example", new()
{
Name = "internal",
KubernetesClusterId = exampleKubernetesCluster.Id,
VmSize = "Standard_DS2_v2",
NodeCount = 1,
Tags =
{
{ "Environment", "Production" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/containerservice"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleKubernetesCluster, err := containerservice.NewKubernetesCluster(ctx, "example", &containerservice.KubernetesClusterArgs{
Name: pulumi.String("example-aks1"),
Location: example.Location,
ResourceGroupName: example.Name,
DnsPrefix: pulumi.String("exampleaks1"),
DefaultNodePool: &containerservice.KubernetesClusterDefaultNodePoolArgs{
Name: pulumi.String("default"),
NodeCount: pulumi.Int(1),
VmSize: pulumi.String("Standard_D2_v2"),
},
ServicePrincipal: &containerservice.KubernetesClusterServicePrincipalArgs{
ClientId: pulumi.String("00000000-0000-0000-0000-000000000000"),
ClientSecret: pulumi.String("00000000000000000000000000000000"),
},
})
if err != nil {
return err
}
_, err = containerservice.NewKubernetesClusterNodePool(ctx, "example", &containerservice.KubernetesClusterNodePoolArgs{
Name: pulumi.String("internal"),
KubernetesClusterId: exampleKubernetesCluster.ID(),
VmSize: pulumi.String("Standard_DS2_v2"),
NodeCount: pulumi.Int(1),
Tags: pulumi.StringMap{
"Environment": pulumi.String("Production"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.containerservice.KubernetesCluster;
import com.pulumi.azure.containerservice.KubernetesClusterArgs;
import com.pulumi.azure.containerservice.inputs.KubernetesClusterDefaultNodePoolArgs;
import com.pulumi.azure.containerservice.inputs.KubernetesClusterServicePrincipalArgs;
import com.pulumi.azure.containerservice.KubernetesClusterNodePool;
import com.pulumi.azure.containerservice.KubernetesClusterNodePoolArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleKubernetesCluster = new KubernetesCluster("exampleKubernetesCluster", KubernetesClusterArgs.builder()
.name("example-aks1")
.location(example.location())
.resourceGroupName(example.name())
.dnsPrefix("exampleaks1")
.defaultNodePool(KubernetesClusterDefaultNodePoolArgs.builder()
.name("default")
.nodeCount(1)
.vmSize("Standard_D2_v2")
.build())
.servicePrincipal(KubernetesClusterServicePrincipalArgs.builder()
.clientId("00000000-0000-0000-0000-000000000000")
.clientSecret("00000000000000000000000000000000")
.build())
.build());
var exampleKubernetesClusterNodePool = new KubernetesClusterNodePool("exampleKubernetesClusterNodePool", KubernetesClusterNodePoolArgs.builder()
.name("internal")
.kubernetesClusterId(exampleKubernetesCluster.id())
.vmSize("Standard_DS2_v2")
.nodeCount(1)
.tags(Map.of("Environment", "Production"))
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleKubernetesCluster:
type: azure:containerservice:KubernetesCluster
name: example
properties:
name: example-aks1
location: ${example.location}
resourceGroupName: ${example.name}
dnsPrefix: exampleaks1
defaultNodePool:
name: default
nodeCount: 1
vmSize: Standard_D2_v2
servicePrincipal:
clientId: 00000000-0000-0000-0000-000000000000
clientSecret: '00000000000000000000000000000000'
exampleKubernetesClusterNodePool:
type: azure:containerservice:KubernetesClusterNodePool
name: example
properties:
name: internal
kubernetesClusterId: ${exampleKubernetesCluster.id}
vmSize: Standard_DS2_v2
nodeCount: 1
tags:
Environment: Production
Import
Kubernetes Cluster Node Pools can be imported using the resource id
, e.g.
$ pulumi import azure:containerservice/kubernetesClusterNodePool:KubernetesClusterNodePool pool1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool1
Properties
Whether to enable auto-scaler.
Specifies the ID of the Capacity Reservation Group where this Node Pool should exist. Changing this forces a new resource to be created.
The Eviction Policy which should be used for Virtual Machines within the Virtual Machine Scale Set powering this Node Pool. Possible values are Deallocate
and Delete
. Changing this forces a new resource to be created.
Should the nodes in this Node Pool have Federal Information Processing Standard enabled? Changing this property requires specifying temporary_name_for_rotation
.
Specifies the GPU MIG instance profile for supported GPU VM SKU. The allowed values are MIG1g
, MIG2g
, MIG3g
, MIG4g
and MIG7g
. Changing this forces a new resource to be created.
Should the nodes in this Node Pool have host encryption enabled? Changing this property requires specifying temporary_name_for_rotation
.
The fully qualified resource ID of the Dedicated Host Group to provision virtual machines from. Changing this forces a new resource to be created.
A kubelet_config
block as defined below. Changing this requires specifying temporary_name_for_rotation
.
The type of disk used by kubelet. Possible values are OS
and Temporary
. Changing this property requires specifying temporary_name_for_rotation
.
The ID of the Kubernetes Cluster where this Node Pool should exist. Changing this forces a new resource to be created.
A linux_os_config
block as defined below. Changing this requires specifying temporary_name_for_rotation
.
A map of Kubernetes labels which should be applied to nodes in this Node Pool.
A node_network_profile
block as documented below.
Should each node have a Public IP Address? Changing this property requires specifying temporary_name_for_rotation
.
Resource ID for the Public IP Addresses Prefix for the nodes in this Node Pool. node_public_ip_enabled
should be true
. Changing this forces a new resource to be created.
A list of Kubernetes taints which should be applied to nodes in the agent pool (e.g key=value:NoSchedule
).
Version of Kubernetes used for the Agents. If not specified, the latest recommended version will be used at provisioning time (but won't auto-upgrade). AKS does not require an exact patch version to be specified, minor version aliases such as 1.22
are also supported. - The minor version's latest GA patch is automatically chosen in that case. More details can be found in the documentation.
The Agent Operating System disk size in GB. Changing this property requires specifying temporary_name_for_rotation
.
The type of disk which should be used for the Operating System. Possible values are Ephemeral
and Managed
. Defaults to Managed
. Changing this property requires specifying temporary_name_for_rotation
.
Specifies the OS SKU used by the agent pool. Possible values are AzureLinux
, Ubuntu
, Windows2019
and Windows2022
. If not specified, the default is Ubuntu
if OSType=Linux or Windows2019
if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022
after Windows2019 is deprecated. Changing this from AzureLinux
or Ubuntu
to AzureLinux
or Ubuntu
will not replace the resource, otherwise it forces a new resource to be created.
The ID of the Subnet where the pods in the Node Pool should exist. Changing this property requires specifying temporary_name_for_rotation
.
The ID of the Proximity Placement Group where the Virtual Machine Scale Set that powers this Node Pool will be placed. Changing this forces a new resource to be created.
Specifies how the node pool should deal with scaled-down nodes. Allowed values are Delete
and Deallocate
. Defaults to Delete
.
The ID of the Snapshot which should be used to create this Node Pool. Changing this property requires specifying temporary_name_for_rotation
.
The maximum price you're willing to pay in USD per Virtual Machine. Valid values are -1
(the current on-demand price for a Virtual Machine) or a positive value with up to five decimal places. Changing this forces a new resource to be created.
Specifies the name of the temporary node pool used to cycle the node pool when one of the relevant properties are updated.
Used to specify whether the UltraSSD is enabled in the Node Pool. Defaults to false
. See the documentation for more information. Changing this property requires specifying temporary_name_for_rotation
.
A upgrade_settings
block as documented below.
The ID of the Subnet where this Node Pool should exist. Changing this property requires specifying temporary_name_for_rotation
.
A windows_profile
block as documented below. Changing this forces a new resource to be created.
Used to specify the workload runtime. Allowed values are OCIContainer
and WasmWasi
.