Edit

Share via


New-AzAksNodePool

Create a new node pool in specified cluster.

Syntax

defaultParameterSet

New-AzAksNodePool
    -ResourceGroupName <String>
    -ClusterName <String>
    -Name <String>
    [-Count <Int32>]
    [-OsDiskSize <Int32>]
    [-VmSize <String>]
    [-VnetSubnetID <String>]
    [-MaxPodCount <Int32>]
    [-OsType <String>]
    [-OsSKU <String>]
    [-EnableNodePublicIp]
    [-NodePublicIPPrefixID <String>]
    [-ScaleSetPriority <String>]
    [-ScaleSetEvictionPolicy <String>]
    [-VmSetType <String>]
    [-AvailabilityZone <String[]>]
    [-Force]
    [-EnableEncryptionAtHost]
    [-EnableUltraSSD]
    [-LinuxOSConfig <LinuxOSConfig>]
    [-KubeletConfig <KubeletConfig>]
    [-MaxSurge <String>]
    [-PPG <String>]
    [-SpotMaxPrice <Double>]
    [-EnableFIPS]
    [-GpuInstanceProfile <String>]
    [-HostGroupID <String>]
    [-PodSubnetID <String>]
    [-KubernetesVersion <String>]
    [-MinCount <Int32>]
    [-MaxCount <Int32>]
    [-EnableAutoScaling]
    [-Mode <String>]
    [-NodeLabel <Hashtable>]
    [-Tag <Hashtable>]
    [-NodeTaint <String[]>]
    [-AksCustomHeader <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [-SubscriptionId <String>]
    [<CommonParameters>]

ParentObjectParameterSet

New-AzAksNodePool
    -Name <String>
    -ClusterObject <PSKubernetesCluster>
    [-Count <Int32>]
    [-OsDiskSize <Int32>]
    [-VmSize <String>]
    [-VnetSubnetID <String>]
    [-MaxPodCount <Int32>]
    [-OsType <String>]
    [-OsSKU <String>]
    [-EnableNodePublicIp]
    [-NodePublicIPPrefixID <String>]
    [-ScaleSetPriority <String>]
    [-ScaleSetEvictionPolicy <String>]
    [-VmSetType <String>]
    [-AvailabilityZone <String[]>]
    [-Force]
    [-EnableEncryptionAtHost]
    [-EnableUltraSSD]
    [-LinuxOSConfig <LinuxOSConfig>]
    [-KubeletConfig <KubeletConfig>]
    [-MaxSurge <String>]
    [-PPG <String>]
    [-SpotMaxPrice <Double>]
    [-EnableFIPS]
    [-GpuInstanceProfile <String>]
    [-HostGroupID <String>]
    [-PodSubnetID <String>]
    [-KubernetesVersion <String>]
    [-MinCount <Int32>]
    [-MaxCount <Int32>]
    [-EnableAutoScaling]
    [-Mode <String>]
    [-NodeLabel <Hashtable>]
    [-Tag <Hashtable>]
    [-NodeTaint <String[]>]
    [-AksCustomHeader <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [-SubscriptionId <String>]
    [<CommonParameters>]

Description

Create a new node pool in specified cluster.

Examples

Example 1: Create a node pool with default parameters

New-AzAksNodePool -ResourceGroupName myResourceGroup -ClusterName myCluster -Name mydefault

Example 2: Create Windows Server container on an AKS

$cred = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzAksCluster -ResourceGroupName myResourceGroup -Name myCluster -WindowsProfileAdminUserName azureuser -WindowsProfileAdminUserPassword $cred -NetworkPlugin azure -NodeVmSetType VirtualMachineScaleSets
New-AzAksNodePool -ResourceGroupName myResourceGroup -ClusterName myCluster -Name win1 -OsType Windows -VmSetType VirtualMachineScaleSets

Example 3: Create a node pool with LinuxOSConfig and KubeletConfig.

When you create an AKS node pool, you can specify the kubelet and OS configurations. The type of LinuxOSConfig and KubeletConfig must be Microsoft.Azure.Management.ContainerService.Models.LinuxOSConfig and Microsoft.Azure.Management.ContainerService.Models.KubeletConfig respectively.

$linuxOsConfigJsonStr = @'
            {
             "transparentHugePageEnabled": "madvise",
             "transparentHugePageDefrag": "defer+madvise",
             "swapFileSizeMB": 1500,
             "sysctls": {
              "netCoreSomaxconn": 163849,
              "netIpv4TcpTwReuse": true,
              "netIpv4IpLocalPortRange": "32000 60000"
             }
            }
'@
$linuxOsConfig = [Microsoft.Azure.Management.ContainerService.Models.LinuxOSConfig] ($linuxOsConfigJsonStr | ConvertFrom-Json)
$kubeletConfigStr = @'
            {
             "failSwapOn": false
            }
'@
$kubeletConfig = [Microsoft.Azure.Management.ContainerService.Models.KubeletConfig] ($kubeletConfigStr | ConvertFrom-Json)

New-AzAksNodePool -ResourceGroupName myResourceGroup -ClusterName myAKSCluster -Name mypool -LinuxOSConfig $linuxOsConfig -KubeletConfig $kubeletConfig

Parameters

-AksCustomHeader

Aks custom headers

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AvailabilityZone

Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ClusterName

The name of the managed cluster resource.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

defaultParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ClusterObject

Specify cluster object in which to create node pool.

Parameter properties

Type:PSKubernetesCluster
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ParentObjectParameterSet
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Count

The default number of nodes for the node pools.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableAutoScaling

Whether to enable auto-scaler

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableEncryptionAtHost

Whether to enable host based OS and data drive

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableFIPS

Whether to use a FIPS-enabled OS

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableNodePublicIp

Whether to enable public IP for nodes.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableUltraSSD

whether to enable UltraSSD

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Create node pool even if it already exists

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GpuInstanceProfile

The GpuInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HostGroupID

The fully qualified resource ID of the Dedicated Host Group to provision virtual machines from, used only in creation scenario and not allowed to changed once set.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KubeletConfig

The Kubelet configuration on the agent pool nodes.

Parameter properties

Type:KubeletConfig
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KubernetesVersion

The version of Kubernetes to use for creating the cluster.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LinuxOSConfig

The OS configuration of Linux agent nodes.

Parameter properties

Type:LinuxOSConfig
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaxCount

Maximum number of nodes for auto-scaling

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaxPodCount

Maximum number of pods that can run on node.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaxSurge

The maximum number or percentage of nodes that ar surged during upgrade.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinCount

Minimum number of nodes for auto-scaling.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Mode

The pool mode

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The name of the node pool.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NodeLabel

Node pool labels used for building Kubernetes network.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NodePublicIPPrefixID

The resource Id of public IP prefix for node pool.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NodeTaint

The node taints added to new nodes during node pool create and scale

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OsDiskSize

The default number of nodes for the node pools.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OsSKU

OsSKU to be used to specify OS SKU. The default is Ubuntu if OSType is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType is Windows.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OsType

OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PodSubnetID

The ID of the subnet which pods will join when launched.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PPG

The ID for Proximity Placement Group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

The name of the resource group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

defaultParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScaleSetEvictionPolicy

ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScaleSetPriority

ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SpotMaxPrice

The max price (in US Dollars) you are willing to pay for spot instances. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand.

Parameter properties

Type:

Nullable<T>[Double]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubscriptionId

The ID of the subscription. By default, cmdlets are executed in the subscription that is set in the current context. If the user specifies another subscription, the current cmdlet is executed in the subscription specified by the user. Overriding subscriptions only take effect during the lifecycle of the current cmdlet. It does not change the subscription in the context, and does not affect subsequent cmdlets.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tag

The tags to be persisted on the agent pool virtual machine scale set.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VmSetType

Represents types of an node pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VmSize

The size of the Virtual Machine. Default value is dynamically selected by the AKS resource provider based on quota and capacity.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VnetSubnetID

VNet SubnetID specifies the VNet's subnet identifier.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSKubernetesCluster

Outputs

PSNodePool