Crée ou met à jour un pool d’agents dans le cluster managé spécifié.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}?api-version=2024-09-01
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
agentPoolName
|
path |
True
|
string
|
Nom du pool d’agents.
Modèle d’expression régulière: ^[a-z][a-z0-9]{0,11}$
|
resourceGroupName
|
path |
True
|
string
|
Nom du groupe de ressources. Le nom ne respecte pas la casse.
|
resourceName
|
path |
True
|
string
|
Nom de la ressource de cluster managé.
Modèle d’expression régulière: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
subscriptionId
|
path |
True
|
string
uuid
|
ID de l’abonnement cible. La valeur doit être un UUID.
|
api-version
|
query |
True
|
string
|
Version de l’API à utiliser pour cette opération.
|
Nom |
Obligatoire |
Type |
Description |
If-Match
|
|
string
|
La requête ne doit continuer que si une entité correspond à cette chaîne.
|
If-None-Match
|
|
string
|
La requête ne doit continuer que si aucune entité ne correspond à cette chaîne.
|
Corps de la demande
Nom |
Type |
Description |
properties.availabilityZones
|
string[]
|
Liste des zones de disponibilité à utiliser pour les nœuds. Cela ne peut être spécifié que si la propriété AgentPoolType est « VirtualMachineScaleSets ».
|
properties.capacityReservationGroupID
|
string
|
ID de ressource complet du groupe de réservations de capacité pour fournir des machines virtuelles à partir d’un groupe réservé de machines virtuelles.
AKS associe le pool d’agents spécifié au groupe de réservations de capacité.
|
properties.count
|
integer
|
Nombre d’agents (machines virtuelles) pour héberger des conteneurs Docker. Les valeurs autorisées doivent être comprises entre 0 et 1 000 (inclus) pour les pools d’utilisateurs et dans la plage comprise entre 1 et 1 000 (inclus) pour les pools système. La valeur par défaut est 1.
|
properties.creationData
|
CreationData
|
CreationData à utiliser pour spécifier l’ID d’instantané source si le pool de nœuds sera créé/mis à niveau à l’aide d’un instantané.
|
properties.enableAutoScaling
|
boolean
|
Indique s’il faut activer la mise à l’échelle automatique
|
properties.enableEncryptionAtHost
|
boolean
|
Indique s’il faut activer le chiffrement du système d’exploitation et du lecteur de données basés sur l’hôte.
Cela n’est pris en charge que sur certaines tailles de machine virtuelle et dans certaines régions Azure. Pour plus d’informations, consultez : https://docs.microsoft.com/azure/aks/enable-host-encryption
|
properties.enableFIPS
|
boolean
|
Indique s’il faut utiliser un système d’exploitation compatible FIPS.
Pour plus d’informations, consultez Ajouter un pool de nœuds compatible FIPS.
|
properties.enableNodePublicIP
|
boolean
|
Indique si chaque nœud est alloué à sa propre adresse IP publique.
Certains scénarios peuvent nécessiter des nœuds dans un pool de nœuds pour recevoir leurs propres adresses IP publiques dédiées. Un scénario courant concerne les charges de travail de jeu, où une console doit établir une connexion directe à une machine virtuelle cloud afin de réduire les tronçons. Pour plus d’informations, consultez affectation d’une adresse IP publique par nœud. La valeur par défaut est false.
|
properties.enableUltraSSD
|
boolean
|
Indique s’il faut activer UltraSSD
|
properties.gpuInstanceProfile
|
GPUInstanceProfile
|
GPUInstanceProfile à utiliser pour spécifier le profil d’instance GPU MIG pour la référence SKU de machine virtuelle GPU prise en charge.
|
properties.hostGroupID
|
string
|
ID de ressource complet du groupe hôte dédié à partir duquel provisionner des machines virtuelles, utilisé uniquement dans le scénario de création et non autorisé à changer une fois défini.
Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. Pour plus d’informations, consultez hôtes dédiés Azure.
|
properties.kubeletConfig
|
KubeletConfig
|
Configurations Kubelet des nœuds d’agent.
Configuration Kubelet sur les nœuds du pool d’agents.
|
properties.kubeletDiskType
|
KubeletDiskType
|
Détermine le placement des volumes emptyDir, de la racine des données du runtime de conteneur et du stockage éphémère Kubelet.
|
properties.linuxOSConfig
|
LinuxOSConfig
|
Configurations du système d’exploitation des nœuds d’agent Linux.
Configuration du système d’exploitation des nœuds de l’agent Linux.
|
properties.maxCount
|
integer
|
Nombre maximal de nœuds pour la mise à l’échelle automatique
|
properties.maxPods
|
integer
|
Nombre maximal de pods qui peuvent s’exécuter sur un nœud.
|
properties.minCount
|
integer
|
Nombre minimal de nœuds pour la mise à l’échelle automatique
|
properties.mode
|
AgentPoolMode
|
Mode d’un pool d’agents.
Un cluster doit avoir au moins un pool d’agents « Système » à tout moment. Pour plus d’informations sur les restrictions de pool d’agents et les meilleures pratiques, consultez : https://docs.microsoft.com/azure/aks/use-system-pools
|
properties.networkProfile
|
AgentPoolNetworkProfile
|
Paramètres liés au réseau d’un pool d’agents.
|
properties.nodeLabels
|
object
|
Étiquettes de nœud à conserver sur tous les nœuds du pool d’agents.
|
properties.nodePublicIPPrefixID
|
string
|
ID de préfixe IP public à partir duquel les nœuds de machine virtuelle doivent utiliser des adresses IP.
Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}
|
properties.nodeTaints
|
string[]
|
Les teintes ajoutées aux nouveaux nœuds pendant la création et la mise à l’échelle du pool de nœuds. Par exemple, key=value :NoSchedule.
|
properties.orchestratorVersion
|
string
|
Version de Kubernetes spécifiée par l’utilisateur.
Les deux versions de correctif <> major.minor.patch (par exemple, 1.20.13) et <> major.minor (par exemple, 1,20) sont prises en charge. Lorsque <> major.minor est spécifié, la dernière version de correctif ga prise en charge est choisie automatiquement. La mise à jour du cluster avec le même <major.minor> une fois qu’il a été créé (par exemple, 1.14.x -> 1.14) ne déclenche pas de mise à niveau, même si une version de correctif plus récente est disponible. En guise de meilleure pratique, vous devez mettre à niveau tous les pools de nœuds d’un cluster AKS vers la même version de Kubernetes. La version du pool de nœuds doit avoir la même version principale que le plan de contrôle. La version mineure du pool de nœuds doit se trouver dans deux versions mineures de la version du plan de contrôle. La version du pool de nœuds ne peut pas être supérieure à la version du plan de contrôle. Pour plus d’informations, consultez mise à niveau d’un pool de nœuds.
|
properties.osDiskSizeGB
|
integer
|
Taille du disque du système d’exploitation en Go à utiliser pour spécifier la taille du disque pour chaque ordinateur du pool maître/agent. Si vous spécifiez 0, elle applique la taille osDisk par défaut en fonction de vmSize spécifiée.
|
properties.osDiskType
|
OSDiskType
|
Type de disque du système d’exploitation à utiliser pour les machines du pool d’agents.
La valeur par défaut est « Éphémère » si la machine virtuelle la prend en charge et a un disque de cache supérieur à celui demandé d’OSDiskSizeGB. Sinon, la valeur par défaut est « Gérée ». Peut ne pas être modifié après la création. Pour plus d’informations, consultez système d’exploitation éphémère.
|
properties.osSKU
|
OSSKU
|
Spécifie la référence SKU du système d’exploitation utilisée par le pool d’agents. La valeur par défaut est Ubuntu si OSType est Linux. La valeur par défaut est Windows2019 quand Kubernetes <= 1.24 ou Windows2022 quand Kubernetes >= 1.25 si OSType est Windows.
|
properties.osType
|
OSType
|
Type de système d’exploitation. La valeur par défaut est Linux.
|
properties.podSubnetID
|
string
|
ID du sous-réseau auquel les pods seront joints lors du lancement.
En cas d’omission, les adresses IP de pod sont affectées statiquement sur le sous-réseau de nœud (voir vnetSubnetID pour plus d’informations). Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
properties.powerState
|
PowerState
|
Indique si le pool d’agents est en cours d’exécution ou arrêté.
Lorsqu’un pool d’agents est créé pour la première fois, il est en cours d’exécution. Le pool d’agents peut être arrêté en définissant ce champ sur Arrêté. Un pool d’agents arrêté arrête toutes ses machines virtuelles et n’accumule pas de frais de facturation. Un pool d’agents ne peut être arrêté que s’il est en cours d’exécution et si l’état d’approvisionnement est Réussi
|
properties.proximityPlacementGroupID
|
string
|
ID du groupe de placement de proximité.
|
properties.scaleDownMode
|
ScaleDownMode
|
Mode scale-down à utiliser lors de la mise à l’échelle du pool d’agents.
Cela affecte également le comportement du générateur de mise à l’échelle automatique du cluster. S’il n’est pas spécifié, il est défini par défaut sur Delete.
|
properties.scaleSetEvictionPolicy
|
ScaleSetEvictionPolicy
|
Stratégie d’éviction du groupe de machines virtuelles identiques à utiliser.
Cela ne peut pas être spécifié, sauf si scaleSetPriority est « Spot ». S’il n’est pas spécifié, la valeur par défaut est « Supprimer ».
|
properties.scaleSetPriority
|
ScaleSetPriority
|
Priorité du groupe de machines virtuelles identiques. S’il n’est pas spécifié, la valeur par défaut est « Standard ».
|
properties.securityProfile
|
AgentPoolSecurityProfile
|
Paramètres de sécurité d’un pool d’agents.
|
properties.spotMaxPrice
|
number
|
Le prix maximal (en dollars AMÉRICAINs) que vous êtes prêt à payer pour les instances spot. Les valeurs possibles sont toutes les valeurs décimales supérieures à zéro ou -1 qui indiquent le prix par défaut up-to à la demande.
Les valeurs possibles sont une valeur décimale supérieure à zéro ou -1 qui indique la volonté de payer n’importe quel prix à la demande. Pour plus d’informations sur la tarification spot, consultez tarification des machines virtuelles spot
|
properties.tags
|
object
|
Balises à conserver sur le groupe de machines virtuelles identiques du pool d’agents.
|
properties.type
|
AgentPoolType
|
Type de pool d’agents.
|
properties.upgradeSettings
|
AgentPoolUpgradeSettings
|
Paramètres de mise à niveau du pool d’agents
|
properties.vmSize
|
string
|
Taille des machines virtuelles du pool d’agents.
La disponibilité de la taille des machines virtuelles varie selon la région. Si un nœud contient des ressources de calcul insuffisantes (mémoire, processeur, etc.) les pods peuvent échouer à s’exécuter correctement. Pour plus d’informations sur les tailles de machine virtuelle restreintes, consultez : https://docs.microsoft.com/azure/aks/quotas-skus-regions
|
properties.vnetSubnetID
|
string
|
ID du sous-réseau sur lequel les nœuds du pool d’agents et éventuellement les pods se joignent au démarrage.
Si ce n’est pas spécifié, un réseau virtuel et un sous-réseau sont générés et utilisés. Si aucun podSubnetID n’est spécifié, cela s’applique aux nœuds et aux pods, sinon il s’applique uniquement aux nœuds. Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
properties.windowsProfile
|
AgentPoolWindowsProfile
|
Profil spécifique du pool d’agents Windows.
|
properties.workloadRuntime
|
WorkloadRuntime
|
Détermine le type de charge de travail qu’un nœud peut exécuter.
|
Réponses
Nom |
Type |
Description |
200 OK
|
AgentPool
|
Le pool d’agents existant a été correctement mis à jour.
|
201 Created
|
AgentPool
|
Le nouveau pool d’agents a été créé avec succès.
|
Other Status Codes
|
CloudError
|
Réponse d’erreur décrivant pourquoi l’opération a échoué.
|
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
Nom |
Description |
user_impersonation
|
emprunter l’identité de votre compte d’utilisateur
|
Exemples
Create Agent Pool using an agent pool snapshot
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"enableFIPS": true,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.CreationData;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_Snapshot.json
*/
/**
* Sample code: Create Agent Pool using an agent pool snapshot.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolUsingAnAgentPoolSnapshot(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools()
.createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3)
.withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("").withEnableFips(true)
.withCreationData(new CreationData().withSourceResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_snapshot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
},
"enableFIPS": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Snapshot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Snapshot.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolUsingAnAgentPoolSnapshot() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
CreationData: &armcontainerservice.CreationData{
SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"),
},
EnableFIPS: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CreationData: &armcontainerservice.CreationData{
// SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"),
// },
// CurrentOrchestratorVersion: to.Ptr("1.19.6"),
// EnableFIPS: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.19.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Snapshot.json
*/
async function createAgentPoolUsingAnAgentPoolSnapshot() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
creationData: {
sourceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1",
},
enableFips: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.19.6",
"currentOrchestratorVersion": "1.19.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableFIPS": true,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.19.6",
"currentOrchestratorVersion": "1.19.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableFIPS": true,
"creationData": {
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1"
}
}
}
Create Agent Pool with Capacity Reservation Group
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_CRG.json
*/
/**
* Sample code: Create Agent Pool with Capacity Reservation Group.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createAgentPoolWithCapacityReservationGroup(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("").withCapacityReservationGroupId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_crg.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
"count": 3,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_CRG.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_CRG.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithCapacityReservationGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
CapacityReservationGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"),
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// CapacityReservationGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"),
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_CRG.json
*/
async function createAgentPoolWithCapacityReservationGroup() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
capacityReservationGroupID:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1",
count: 3,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"capacityReservationGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"
}
}
Create Agent Pool with Dedicated Host Group
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_DedicatedHostGroup.json
*/
/**
* Sample code: Create Agent Pool with Dedicated Host Group.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithDedicatedHostGroup(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools()
.createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3)
.withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("").withHostGroupId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_dedicated_host_group.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_DedicatedHostGroup.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_DedicatedHostGroup.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHostGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
HostGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// HostGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.19.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_DedicatedHostGroup.json
*/
async function createAgentPoolWithDedicatedHostGroup() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
hostGroupID:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1",
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.19.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.19.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"hostGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"
}
}
Create Agent Pool with EncryptionAtHost enabled
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"enableEncryptionAtHost": true
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_EnableEncryptionAtHost.json
*/
/**
* Sample code: Create Agent Pool with EncryptionAtHost enabled.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createAgentPoolWithEncryptionAtHostEnabled(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("").withEnableEncryptionAtHost(true),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_enable_encryption_at_host.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableEncryptionAtHost": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEncryptionAtHostEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableEncryptionAtHost: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.13"),
// EnableEncryptionAtHost: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.13"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json
*/
async function createAgentPoolWithEncryptionAtHostEnabled() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
enableEncryptionAtHost: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.13",
"currentOrchestratorVersion": "1.17.13",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableEncryptionAtHost": true
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.13",
"currentOrchestratorVersion": "1.17.13",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableEncryptionAtHost": true
}
}
Create Agent Pool with Ephemeral OS Disk
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"osDiskType": "Ephemeral",
"osDiskSizeGB": 64
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSDiskType;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_Ephemeral.json
*/
/**
* Sample code: Create Agent Pool with Ephemeral OS Disk.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithEphemeralOSDisk(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsDiskSizeGB(64)
.withOsDiskType(OSDiskType.EPHEMERAL).withOsType(OSType.LINUX).withOrchestratorVersion(""),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_ephemeral.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osDiskType": "Ephemeral",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Ephemeral.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Ephemeral.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEphemeralOsDisk() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr(""),
OSDiskSizeGB: to.Ptr[int32](64),
OSDiskType: to.Ptr(armcontainerservice.OSDiskTypeEphemeral),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSDiskSizeGB: to.Ptr[int32](64),
// OSDiskType: to.Ptr(armcontainerservice.OSDiskTypeEphemeral),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Ephemeral.json
*/
async function createAgentPoolWithEphemeralOSDisk() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
orchestratorVersion: "",
osDiskSizeGB: 64,
osDiskType: "Ephemeral",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"osDiskType": "Ephemeral",
"osDiskSizeGB": 64
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"osDiskType": "Ephemeral",
"kubeletDiskType": "OS",
"osDiskSizeGB": 64
}
}
Create Agent Pool with FIPS enabled OS
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"enableFIPS": true
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_EnableFIPS.json
*/
/**
* Sample code: Create Agent Pool with FIPS enabled OS.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithFIPSEnabledOS(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate(
"rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2")
.withOsType(OSType.LINUX).withOrchestratorVersion("").withEnableFips(true),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_enable_fips.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableFIPS": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableFIPS.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableFIPS.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithFipsEnabledOs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableFIPS: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.19.6"),
// EnableFIPS: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.19.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableFIPS.json
*/
async function createAgentPoolWithFipsEnabledOS() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
enableFips: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.19.6",
"currentOrchestratorVersion": "1.19.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableFIPS": true
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.19.6",
"currentOrchestratorVersion": "1.19.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableFIPS": true
}
}
Create Agent Pool with GPUMIG
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_ND96asr_v4",
"osType": "Linux",
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 12345,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.GpuInstanceProfile;
import com.azure.resourcemanager.containerservice.models.KubeletConfig;
import com.azure.resourcemanager.containerservice.models.LinuxOSConfig;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.SysctlConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_GPUMIG.json
*/
/**
* Sample code: Create Agent Pool with GPUMIG.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithGPUMIG(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools()
.createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3)
.withVmSize("Standard_ND96asr_v4").withOsType(OSType.LINUX).withOrchestratorVersion("")
.withKubeletConfig(new KubeletConfig().withCpuManagerPolicy("static").withCpuCfsQuota(true)
.withCpuCfsQuotaPeriod("200ms").withImageGcHighThreshold(90).withImageGcLowThreshold(70)
.withTopologyManagerPolicy("best-effort")
.withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")).withFailSwapOn(false))
.withLinuxOSConfig(new LinuxOSConfig()
.withSysctls(new SysctlConfig().withNetCoreWmemDefault(12345).withNetIpv4TcpTwReuse(true)
.withNetIpv4IpLocalPortRange("20000 60000").withKernelThreadsMax(99999))
.withTransparentHugePageEnabled("always").withTransparentHugePageDefrag("madvise")
.withSwapFileSizeMB(1500))
.withGpuInstanceProfile(GpuInstanceProfile.MIG2G), null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_gpumig.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"allowedUnsafeSysctls": ["kernel.msg*", "net.core.somaxconn"],
"cpuCfsQuota": True,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": False,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": True,
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always",
},
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_ND96asr_v4",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_GPUMIG.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_GPUMIG.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithGpumig() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
GpuInstanceProfile: to.Ptr(armcontainerservice.GPUInstanceProfileMIG2G),
KubeletConfig: &armcontainerservice.KubeletConfig{
AllowedUnsafeSysctls: []*string{
to.Ptr("kernel.msg*"),
to.Ptr("net.core.somaxconn")},
CPUCfsQuota: to.Ptr(true),
CPUCfsQuotaPeriod: to.Ptr("200ms"),
CPUManagerPolicy: to.Ptr("static"),
FailSwapOn: to.Ptr(false),
ImageGcHighThreshold: to.Ptr[int32](90),
ImageGcLowThreshold: to.Ptr[int32](70),
TopologyManagerPolicy: to.Ptr("best-effort"),
},
LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
SwapFileSizeMB: to.Ptr[int32](1500),
Sysctls: &armcontainerservice.SysctlConfig{
KernelThreadsMax: to.Ptr[int32](99999),
NetCoreWmemDefault: to.Ptr[int32](12345),
NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
NetIPv4TCPTwReuse: to.Ptr(true),
},
TransparentHugePageDefrag: to.Ptr("madvise"),
TransparentHugePageEnabled: to.Ptr("always"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_ND96asr_v4"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// GpuInstanceProfile: to.Ptr(armcontainerservice.GPUInstanceProfileMIG2G),
// KubeletConfig: &armcontainerservice.KubeletConfig{
// AllowedUnsafeSysctls: []*string{
// to.Ptr("kernel.msg*"),
// to.Ptr("net.core.somaxconn")},
// CPUCfsQuota: to.Ptr(true),
// CPUCfsQuotaPeriod: to.Ptr("200ms"),
// CPUManagerPolicy: to.Ptr("static"),
// FailSwapOn: to.Ptr(false),
// ImageGcHighThreshold: to.Ptr[int32](90),
// ImageGcLowThreshold: to.Ptr[int32](70),
// TopologyManagerPolicy: to.Ptr("best-effort"),
// },
// LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
// SwapFileSizeMB: to.Ptr[int32](1500),
// Sysctls: &armcontainerservice.SysctlConfig{
// KernelThreadsMax: to.Ptr[int32](99999),
// NetCoreWmemDefault: to.Ptr[int32](12345),
// NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
// NetIPv4TCPTwReuse: to.Ptr(true),
// },
// TransparentHugePageDefrag: to.Ptr("madvise"),
// TransparentHugePageEnabled: to.Ptr("always"),
// },
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_ND96asr_v4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_GPUMIG.json
*/
async function createAgentPoolWithGpumig() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
gpuInstanceProfile: "MIG2g",
kubeletConfig: {
allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"],
cpuCfsQuota: true,
cpuCfsQuotaPeriod: "200ms",
cpuManagerPolicy: "static",
failSwapOn: false,
imageGcHighThreshold: 90,
imageGcLowThreshold: 70,
topologyManagerPolicy: "best-effort",
},
linuxOSConfig: {
swapFileSizeMB: 1500,
sysctls: {
kernelThreadsMax: 99999,
netCoreWmemDefault: 12345,
netIpv4IpLocalPortRange: "20000 60000",
netIpv4TcpTwReuse: true,
},
transparentHugePageDefrag: "madvise",
transparentHugePageEnabled: "always",
},
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_ND96asr_v4",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_ND96asr_v4",
"maxPods": 110,
"osType": "Linux",
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 12345,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_ND96asr_v4",
"maxPods": 110,
"osType": "Linux",
"gpuInstanceProfile": "MIG2g",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false,
"podMaxPids": 100
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 65536,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
Create Agent Pool with Krustlet and the WASI runtime
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"osDiskSizeGB": 64,
"mode": "User",
"workloadRuntime": "WasmWasi"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolMode;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.WorkloadRuntime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_WasmWasi.json
*/
/**
* Sample code: Create Agent Pool with Krustlet and the WASI runtime.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createAgentPoolWithKrustletAndTheWASIRuntime(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsDiskSizeGB(64)
.withWorkloadRuntime(WorkloadRuntime.WASM_WASI).withOsType(OSType.LINUX).withMode(AgentPoolMode.USER)
.withOrchestratorVersion(""),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_wasm_wasi.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"mode": "User",
"orchestratorVersion": "",
"osDiskSizeGB": 64,
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
"workloadRuntime": "WasmWasi",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WasmWasi.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WasmWasi.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKrustletAndTheWasiRuntime() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
OrchestratorVersion: to.Ptr(""),
OSDiskSizeGB: to.Ptr[int32](64),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
WorkloadRuntime: to.Ptr(armcontainerservice.WorkloadRuntimeWasmWasi),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// MaxPods: to.Ptr[int32](110),
// Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSDiskSizeGB: to.Ptr[int32](64),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// WorkloadRuntime: to.Ptr(armcontainerservice.WorkloadRuntimeWasmWasi),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WasmWasi.json
*/
async function createAgentPoolWithKrustletAndTheWasiRuntime() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
mode: "User",
orchestratorVersion: "",
osDiskSizeGB: 64,
osType: "Linux",
vmSize: "Standard_DS2_v2",
workloadRuntime: "WasmWasi",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"osDiskSizeGB": 64,
"mode": "User",
"workloadRuntime": "WasmWasi"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"osDiskSizeGB": 64,
"mode": "User",
"workloadRuntime": "WasmWasi"
}
}
Create Agent Pool with KubeletConfig and LinuxOSConfig
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 12345,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.KubeletConfig;
import com.azure.resourcemanager.containerservice.models.LinuxOSConfig;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.SysctlConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_CustomNodeConfig.json
*/
/**
* Sample code: Create Agent Pool with KubeletConfig and LinuxOSConfig.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createAgentPoolWithKubeletConfigAndLinuxOSConfig(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools()
.createOrUpdate("rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3)
.withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX).withOrchestratorVersion("")
.withKubeletConfig(new KubeletConfig().withCpuManagerPolicy("static").withCpuCfsQuota(true)
.withCpuCfsQuotaPeriod("200ms").withImageGcHighThreshold(90).withImageGcLowThreshold(70)
.withTopologyManagerPolicy("best-effort")
.withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")).withFailSwapOn(false))
.withLinuxOSConfig(new LinuxOSConfig()
.withSysctls(new SysctlConfig().withNetCoreWmemDefault(12345).withNetIpv4TcpTwReuse(true)
.withNetIpv4IpLocalPortRange("20000 60000").withKernelThreadsMax(99999))
.withTransparentHugePageEnabled("always").withTransparentHugePageDefrag("madvise")
.withSwapFileSizeMB(1500)),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_custom_node_config.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"kubeletConfig": {
"allowedUnsafeSysctls": ["kernel.msg*", "net.core.somaxconn"],
"cpuCfsQuota": True,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": False,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": True,
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always",
},
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_CustomNodeConfig.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_CustomNodeConfig.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKubeletConfigAndLinuxOsConfig() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
KubeletConfig: &armcontainerservice.KubeletConfig{
AllowedUnsafeSysctls: []*string{
to.Ptr("kernel.msg*"),
to.Ptr("net.core.somaxconn")},
CPUCfsQuota: to.Ptr(true),
CPUCfsQuotaPeriod: to.Ptr("200ms"),
CPUManagerPolicy: to.Ptr("static"),
FailSwapOn: to.Ptr(false),
ImageGcHighThreshold: to.Ptr[int32](90),
ImageGcLowThreshold: to.Ptr[int32](70),
TopologyManagerPolicy: to.Ptr("best-effort"),
},
LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
SwapFileSizeMB: to.Ptr[int32](1500),
Sysctls: &armcontainerservice.SysctlConfig{
KernelThreadsMax: to.Ptr[int32](99999),
NetCoreWmemDefault: to.Ptr[int32](12345),
NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
NetIPv4TCPTwReuse: to.Ptr(true),
},
TransparentHugePageDefrag: to.Ptr("madvise"),
TransparentHugePageEnabled: to.Ptr("always"),
},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// KubeletConfig: &armcontainerservice.KubeletConfig{
// AllowedUnsafeSysctls: []*string{
// to.Ptr("kernel.msg*"),
// to.Ptr("net.core.somaxconn")},
// CPUCfsQuota: to.Ptr(true),
// CPUCfsQuotaPeriod: to.Ptr("200ms"),
// CPUManagerPolicy: to.Ptr("static"),
// FailSwapOn: to.Ptr(false),
// ImageGcHighThreshold: to.Ptr[int32](90),
// ImageGcLowThreshold: to.Ptr[int32](70),
// TopologyManagerPolicy: to.Ptr("best-effort"),
// },
// LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
// SwapFileSizeMB: to.Ptr[int32](1500),
// Sysctls: &armcontainerservice.SysctlConfig{
// KernelThreadsMax: to.Ptr[int32](99999),
// NetCoreWmemDefault: to.Ptr[int32](12345),
// NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
// NetIPv4TCPTwReuse: to.Ptr(true),
// },
// TransparentHugePageDefrag: to.Ptr("madvise"),
// TransparentHugePageEnabled: to.Ptr("always"),
// },
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_CustomNodeConfig.json
*/
async function createAgentPoolWithKubeletConfigAndLinuxOSConfig() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
kubeletConfig: {
allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"],
cpuCfsQuota: true,
cpuCfsQuotaPeriod: "200ms",
cpuManagerPolicy: "static",
failSwapOn: false,
imageGcHighThreshold: 90,
imageGcLowThreshold: 70,
topologyManagerPolicy: "best-effort",
},
linuxOSConfig: {
swapFileSizeMB: 1500,
sysctls: {
kernelThreadsMax: 99999,
netCoreWmemDefault: 12345,
netIpv4IpLocalPortRange: "20000 60000",
netIpv4TcpTwReuse: true,
},
transparentHugePageDefrag: "madvise",
transparentHugePageEnabled: "always",
},
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 12345,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false,
"podMaxPids": 100
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 65536,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
Create Agent Pool with OSSKU
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"osSKU": "AzureLinux",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 12345,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.KubeletConfig;
import com.azure.resourcemanager.containerservice.models.LinuxOSConfig;
import com.azure.resourcemanager.containerservice.models.OSSku;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.SysctlConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_OSSKU.json
*/
/**
* Sample code: Create Agent Pool with OSSKU.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithOSSKU(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOsSku(OSSku.AZURE_LINUX).withOrchestratorVersion("")
.withKubeletConfig(new KubeletConfig().withCpuManagerPolicy("static").withCpuCfsQuota(true)
.withCpuCfsQuotaPeriod("200ms").withImageGcHighThreshold(90).withImageGcLowThreshold(70)
.withTopologyManagerPolicy("best-effort")
.withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")).withFailSwapOn(false))
.withLinuxOSConfig(new LinuxOSConfig()
.withSysctls(new SysctlConfig().withNetCoreWmemDefault(12345).withNetIpv4TcpTwReuse(true)
.withNetIpv4IpLocalPortRange("20000 60000").withKernelThreadsMax(99999))
.withTransparentHugePageEnabled("always").withTransparentHugePageDefrag("madvise")
.withSwapFileSizeMB(1500)),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_ossku.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"kubeletConfig": {
"allowedUnsafeSysctls": ["kernel.msg*", "net.core.somaxconn"],
"cpuCfsQuota": True,
"cpuCfsQuotaPeriod": "200ms",
"cpuManagerPolicy": "static",
"failSwapOn": False,
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
},
"linuxOSConfig": {
"swapFileSizeMB": 1500,
"sysctls": {
"kernelThreadsMax": 99999,
"netCoreWmemDefault": 12345,
"netIpv4IpLocalPortRange": "20000 60000",
"netIpv4TcpTwReuse": True,
},
"transparentHugePageDefrag": "madvise",
"transparentHugePageEnabled": "always",
},
"orchestratorVersion": "",
"osSKU": "AzureLinux",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_OSSKU.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_OSSKU.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithOssku() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
KubeletConfig: &armcontainerservice.KubeletConfig{
AllowedUnsafeSysctls: []*string{
to.Ptr("kernel.msg*"),
to.Ptr("net.core.somaxconn")},
CPUCfsQuota: to.Ptr(true),
CPUCfsQuotaPeriod: to.Ptr("200ms"),
CPUManagerPolicy: to.Ptr("static"),
FailSwapOn: to.Ptr(false),
ImageGcHighThreshold: to.Ptr[int32](90),
ImageGcLowThreshold: to.Ptr[int32](70),
TopologyManagerPolicy: to.Ptr("best-effort"),
},
LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
SwapFileSizeMB: to.Ptr[int32](1500),
Sysctls: &armcontainerservice.SysctlConfig{
KernelThreadsMax: to.Ptr[int32](99999),
NetCoreWmemDefault: to.Ptr[int32](12345),
NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
NetIPv4TCPTwReuse: to.Ptr(true),
},
TransparentHugePageDefrag: to.Ptr("madvise"),
TransparentHugePageEnabled: to.Ptr("always"),
},
OrchestratorVersion: to.Ptr(""),
OSSKU: to.Ptr(armcontainerservice.OSSKUAzureLinux),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.8"),
// KubeletConfig: &armcontainerservice.KubeletConfig{
// AllowedUnsafeSysctls: []*string{
// to.Ptr("kernel.msg*"),
// to.Ptr("net.core.somaxconn")},
// CPUCfsQuota: to.Ptr(true),
// CPUCfsQuotaPeriod: to.Ptr("200ms"),
// CPUManagerPolicy: to.Ptr("static"),
// FailSwapOn: to.Ptr(false),
// ImageGcHighThreshold: to.Ptr[int32](90),
// ImageGcLowThreshold: to.Ptr[int32](70),
// TopologyManagerPolicy: to.Ptr("best-effort"),
// },
// LinuxOSConfig: &armcontainerservice.LinuxOSConfig{
// SwapFileSizeMB: to.Ptr[int32](1500),
// Sysctls: &armcontainerservice.SysctlConfig{
// KernelThreadsMax: to.Ptr[int32](99999),
// NetCoreWmemDefault: to.Ptr[int32](12345),
// NetIPv4IPLocalPortRange: to.Ptr("20000 60000"),
// NetIPv4TCPTwReuse: to.Ptr(true),
// },
// TransparentHugePageDefrag: to.Ptr("madvise"),
// TransparentHugePageEnabled: to.Ptr("always"),
// },
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.8"),
// OSSKU: to.Ptr(armcontainerservice.OSSKUAzureLinux),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_OSSKU.json
*/
async function createAgentPoolWithOssku() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
kubeletConfig: {
allowedUnsafeSysctls: ["kernel.msg*", "net.core.somaxconn"],
cpuCfsQuota: true,
cpuCfsQuotaPeriod: "200ms",
cpuManagerPolicy: "static",
failSwapOn: false,
imageGcHighThreshold: 90,
imageGcLowThreshold: 70,
topologyManagerPolicy: "best-effort",
},
linuxOSConfig: {
swapFileSizeMB: 1500,
sysctls: {
kernelThreadsMax: 99999,
netCoreWmemDefault: 12345,
netIpv4IpLocalPortRange: "20000 60000",
netIpv4TcpTwReuse: true,
},
transparentHugePageDefrag: "madvise",
transparentHugePageEnabled: "always",
},
orchestratorVersion: "",
osSKU: "AzureLinux",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"osSKU": "AzureLinux",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 12345,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.8",
"currentOrchestratorVersion": "1.17.8",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"osSKU": "AzureLinux",
"kubeletConfig": {
"cpuManagerPolicy": "static",
"cpuCfsQuota": true,
"cpuCfsQuotaPeriod": "200ms",
"imageGcHighThreshold": 90,
"imageGcLowThreshold": 70,
"topologyManagerPolicy": "best-effort",
"allowedUnsafeSysctls": [
"kernel.msg*",
"net.core.somaxconn"
],
"failSwapOn": false,
"podMaxPids": 100
},
"linuxOSConfig": {
"sysctls": {
"netCoreWmemDefault": 65536,
"netIpv4TcpTwReuse": true,
"netIpv4IpLocalPortRange": "20000 60000",
"kernelThreadsMax": 99999
},
"transparentHugePageEnabled": "always",
"transparentHugePageDefrag": "madvise",
"swapFileSizeMB": 1500
}
}
}
Create Agent Pool with PPG
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_PPG.json
*/
/**
* Sample code: Create Agent Pool with PPG.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithPPG(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("").withProximityPlacementGroupId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_ppg.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "",
"osType": "Linux",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_PPG.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_PPG.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithPpg() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ProximityPlacementGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ProximityPlacementGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_PPG.json
*/
async function createAgentPoolWithPpg() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
orchestratorVersion: "",
osType: "Linux",
proximityPlacementGroupID:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"proximityPlacementGroupID": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.Compute/proximityPlacementGroups/ppg1"
}
}
Create Agent Pool with UltraSSD enabled
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS2_v2",
"osType": "Linux",
"enableUltraSSD": true
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_EnableUltraSSD.json
*/
/**
* Sample code: Create Agent Pool with UltraSSD enabled.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithUltraSSDEnabled(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate(
"rg1", "clustername1", "agentpool1", new AgentPoolInner().withCount(3).withVmSize("Standard_DS2_v2")
.withOsType(OSType.LINUX).withOrchestratorVersion("").withEnableUltraSsd(true),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_enable_ultra_ssd.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableUltraSSD": True,
"orchestratorVersion": "",
"osType": "Linux",
"vmSize": "Standard_DS2_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableUltraSSD.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableUltraSSD.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithUltraSsdEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableUltraSSD: to.Ptr(true),
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
VMSize: to.Ptr("Standard_DS2_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.17.13"),
// EnableUltraSSD: to.Ptr(true),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.17.13"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_DS2_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_EnableUltraSSD.json
*/
async function createAgentPoolWithUltraSsdEnabled() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
enableUltraSSD: true,
orchestratorVersion: "",
osType: "Linux",
vmSize: "Standard_DS2_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.17.13",
"currentOrchestratorVersion": "1.17.13",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableUltraSSD": true
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.17.13",
"currentOrchestratorVersion": "1.17.13",
"count": 3,
"vmSize": "Standard_DS2_v2",
"maxPods": 110,
"osType": "Linux",
"enableUltraSSD": true
}
}
Create Agent Pool with Windows OSSKU
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "1.23.3",
"count": 3,
"vmSize": "Standard_D4s_v3",
"osType": "Windows",
"osSKU": "Windows2022"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSSku;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_WindowsOSSKU.json
*/
/**
* Sample code: Create Agent Pool with Windows OSSKU.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAgentPoolWithWindowsOSSKU(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"wnp2",
new AgentPoolInner().withCount(3).withVmSize("Standard_D4s_v3").withOsType(OSType.WINDOWS)
.withOsSku(OSSku.WINDOWS2022).withOrchestratorVersion("1.23.3"),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_windows_ossku.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="wnp2",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "1.23.3",
"osSKU": "Windows2022",
"osType": "Windows",
"vmSize": "Standard_D4s_v3",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WindowsOSSKU.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WindowsOSSKU.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithWindowsOssku() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "wnp2", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr("1.23.3"),
OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
OSType: to.Ptr(armcontainerservice.OSTypeWindows),
VMSize: to.Ptr("Standard_D4s_v3"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("wnp2"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.23.3"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.23.3"),
// OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
// OSType: to.Ptr(armcontainerservice.OSTypeWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_D4s_v3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WindowsOSSKU.json
*/
async function createAgentPoolWithWindowsOssku() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "wnp2";
const parameters = {
count: 3,
orchestratorVersion: "1.23.3",
osSKU: "Windows2022",
osType: "Windows",
vmSize: "Standard_D4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "wnp2",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.23.3",
"currentOrchestratorVersion": "1.23.3",
"count": 3,
"vmSize": "Standard_D4s_v3",
"maxPods": 110,
"osType": "Windows",
"osSKU": "Windows2022"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "wnp2",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.23.3",
"currentOrchestratorVersion": "1.23.3",
"count": 3,
"vmSize": "Standard_D4s_v3",
"maxPods": 110,
"osType": "Windows",
"osSKU": "Windows2022"
}
}
Create Spot Agent Pool
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS1_v2",
"osType": "Linux",
"tags": {
"name1": "val1"
},
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy;
import com.azure.resourcemanager.containerservice.models.ScaleSetPriority;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_Spot.json
*/
/**
* Sample code: Create Spot Agent Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createSpotAgentPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS1_v2").withOsType(OSType.LINUX)
.withOrchestratorVersion("").withScaleSetPriority(ScaleSetPriority.SPOT)
.withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE).withTags(mapOf("name1", "val1"))
.withNodeLabels(mapOf("key1", "fakeTokenPlaceholder"))
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_spot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"nodeLabels": {"key1": "val1"},
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {"name1": "val1"},
"vmSize": "Standard_DS1_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Spot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Spot.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createSpotAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
NodeLabels: map[string]*string{
"key1": to.Ptr("val1"),
},
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule")},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
Tags: map[string]*string{
"name1": to.Ptr("val1"),
},
VMSize: to.Ptr("Standard_DS1_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// NodeLabels: map[string]*string{
// "key1": to.Ptr("val1"),
// },
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule")},
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
// ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
// SpotMaxPrice: to.Ptr[float32](-1),
// Tags: map[string]*string{
// "name1": to.Ptr("val1"),
// },
// VMSize: to.Ptr("Standard_DS1_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Spot.json
*/
async function createSpotAgentPool() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
nodeLabels: { key1: "val1" },
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "",
osType: "Linux",
scaleSetEvictionPolicy: "Delete",
scaleSetPriority: "Spot",
tags: { name1: "val1" },
vmSize: "Standard_DS1_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS1_v2",
"maxPods": 110,
"osType": "Linux",
"tags": {
"name1": "val1"
},
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete",
"spotMaxPrice": -1
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS1_v2",
"maxPods": 110,
"osType": "Linux",
"tags": {
"name1": "val1"
},
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete",
"spotMaxPrice": -1
}
}
Create Windows Agent Pool with disabling OutboundNAT
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "1.23.8",
"count": 3,
"vmSize": "Standard_D4s_v3",
"osType": "Windows",
"osSKU": "Windows2022",
"windowsProfile": {
"disableOutboundNat": true
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolWindowsProfile;
import com.azure.resourcemanager.containerservice.models.OSSku;
import com.azure.resourcemanager.containerservice.models.OSType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_WindowsDisableOutboundNAT.json
*/
/**
* Sample code: Create Windows Agent Pool with disabling OutboundNAT.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createWindowsAgentPoolWithDisablingOutboundNAT(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"wnp2",
new AgentPoolInner().withCount(3).withVmSize("Standard_D4s_v3").withOsType(OSType.WINDOWS)
.withOsSku(OSSku.WINDOWS2022).withOrchestratorVersion("1.23.8")
.withWindowsProfile(new AgentPoolWindowsProfile().withDisableOutboundNat(true)),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_windows_disable_outbound_nat.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="wnp2",
parameters={
"properties": {
"count": 3,
"orchestratorVersion": "1.23.8",
"osSKU": "Windows2022",
"osType": "Windows",
"vmSize": "Standard_D4s_v3",
"windowsProfile": {"disableOutboundNat": True},
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createWindowsAgentPoolWithDisablingOutboundNat() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "wnp2", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
OrchestratorVersion: to.Ptr("1.23.8"),
OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
OSType: to.Ptr(armcontainerservice.OSTypeWindows),
VMSize: to.Ptr("Standard_D4s_v3"),
WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{
DisableOutboundNat: to.Ptr(true),
},
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("wnp2"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.23.8"),
// MaxPods: to.Ptr[int32](110),
// OrchestratorVersion: to.Ptr("1.23.8"),
// OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022),
// OSType: to.Ptr(armcontainerservice.OSTypeWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// VMSize: to.Ptr("Standard_D4s_v3"),
// WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{
// DisableOutboundNat: to.Ptr(true),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json
*/
async function createWindowsAgentPoolWithDisablingOutboundNat() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "wnp2";
const parameters = {
count: 3,
orchestratorVersion: "1.23.8",
osSKU: "Windows2022",
osType: "Windows",
vmSize: "Standard_D4s_v3",
windowsProfile: { disableOutboundNat: true },
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "wnp2",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.23.8",
"currentOrchestratorVersion": "1.23.8",
"count": 3,
"vmSize": "Standard_D4s_v3",
"maxPods": 110,
"osType": "Windows",
"osSKU": "Windows2022",
"windowsProfile": {
"disableOutboundNat": true
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "wnp2",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.23.8",
"currentOrchestratorVersion": "1.23.8",
"count": 3,
"vmSize": "Standard_D4s_v3",
"maxPods": 110,
"osType": "Windows",
"osSKU": "Windows2022",
"windowsProfile": {
"disableOutboundNat": true
}
}
}
Create/Update Agent Pool
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"vmSize": "Standard_DS1_v2",
"osType": "Linux",
"tags": {
"name1": "val1"
},
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete",
"mode": "User"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.AgentPoolMode;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy;
import com.azure.resourcemanager.containerservice.models.ScaleSetPriority;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPoolsCreate_Update.json
*/
/**
* Sample code: Create/Update Agent Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createUpdateAgentPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS1_v2").withOsType(OSType.LINUX)
.withMode(AgentPoolMode.USER).withOrchestratorVersion("").withScaleSetPriority(ScaleSetPriority.SPOT)
.withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE).withTags(mapOf("name1", "val1"))
.withNodeLabels(mapOf("key1", "fakeTokenPlaceholder"))
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_create_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"mode": "User",
"nodeLabels": {"key1": "val1"},
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"tags": {"name1": "val1"},
"vmSize": "Standard_DS1_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Update.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Update.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
NodeLabels: map[string]*string{
"key1": to.Ptr("val1"),
},
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule")},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
Tags: map[string]*string{
"name1": to.Ptr("val1"),
},
VMSize: to.Ptr("Standard_DS1_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// MaxPods: to.Ptr[int32](110),
// Mode: to.Ptr(armcontainerservice.AgentPoolModeUser),
// NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"),
// NodeLabels: map[string]*string{
// "key1": to.Ptr("val1"),
// },
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule")},
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
// ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
// Tags: map[string]*string{
// "name1": to.Ptr("val1"),
// },
// VMSize: to.Ptr("Standard_DS1_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPoolsCreate_Update.json
*/
async function createOrUpdateAgentPool() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
mode: "User",
nodeLabels: { key1: "val1" },
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "",
osType: "Linux",
scaleSetEvictionPolicy: "Delete",
scaleSetPriority: "Spot",
tags: { name1: "val1" },
vmSize: "Standard_DS1_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS1_v2",
"maxPods": 110,
"osType": "Linux",
"tags": {
"name1": "val1"
},
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete",
"mode": "User",
"nodeImageVersion": "AKSUbuntu:1604:2020.03.11"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Creating",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"vmSize": "Standard_DS1_v2",
"maxPods": 110,
"osType": "Linux",
"tags": {
"name1": "val1"
},
"nodeLabels": {
"key1": "val1"
},
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete",
"mode": "User"
}
}
Start Agent Pool
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"powerState": {
"code": "Running"
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.Code;
import com.azure.resourcemanager.containerservice.models.PowerState;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPools_Start.json
*/
/**
* Sample code: Start Agent Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void startAgentPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1", new AgentPoolInner().withPowerState(new PowerState().withCode(Code.RUNNING)), null, null,
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_start.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={"properties": {"powerState": {"code": "Running"}}},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Start.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Start.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_startAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
PowerState: &armcontainerservice.PowerState{
Code: to.Ptr(armcontainerservice.CodeRunning),
},
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](50),
// EnableAutoScaling: to.Ptr(true),
// MaxCount: to.Ptr[int32](55),
// MinCount: to.Ptr[int32](3),
// PowerState: &armcontainerservice.PowerState{
// Code: to.Ptr(armcontainerservice.CodeRunning),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Start.json
*/
async function startAgentPool() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = { powerState: { code: "Running" } };
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Starting",
"count": 50,
"enableAutoScaling": true,
"minCount": 3,
"maxCount": 55,
"powerState": {
"code": "Running"
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Starting",
"count": 50,
"enableAutoScaling": true,
"minCount": 3,
"maxCount": 55,
"powerState": {
"code": "Running"
}
}
}
Stop Agent Pool
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"powerState": {
"code": "Stopped"
}
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.Code;
import com.azure.resourcemanager.containerservice.models.PowerState;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPools_Stop.json
*/
/**
* Sample code: Stop Agent Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void stopAgentPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1", new AgentPoolInner().withPowerState(new PowerState().withCode(Code.STOPPED)), null, null,
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_stop.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={"properties": {"powerState": {"code": "Stopped"}}},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Stop.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Stop.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_stopAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
PowerState: &armcontainerservice.PowerState{
Code: to.Ptr(armcontainerservice.CodeStopped),
},
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](0),
// EnableAutoScaling: to.Ptr(false),
// PowerState: &armcontainerservice.PowerState{
// Code: to.Ptr(armcontainerservice.CodeStopped),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Stop.json
*/
async function stopAgentPool() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = { powerState: { code: "Stopped" } };
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Stopping",
"count": 0,
"enableAutoScaling": false,
"minCount": null,
"maxCount": null,
"powerState": {
"code": "Stopped"
}
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Stopping",
"count": 0,
"enableAutoScaling": false,
"minCount": null,
"maxCount": null,
"powerState": {
"code": "Stopped"
}
}
}
Update Agent Pool
Exemple de requête
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1?api-version=2024-09-01
{
"properties": {
"orchestratorVersion": "",
"count": 3,
"enableAutoScaling": true,
"minCount": 2,
"maxCount": 2,
"vmSize": "Standard_DS1_v2",
"osType": "Linux",
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete"
}
}
import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.resourcemanager.containerservice.models.OSType;
import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy;
import com.azure.resourcemanager.containerservice.models.ScaleSetPriority;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for AgentPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* AgentPools_Update.json
*/
/**
* Sample code: Update Agent Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void updateAgentPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getAgentPools().createOrUpdate("rg1", "clustername1",
"agentpool1",
new AgentPoolInner().withCount(3).withVmSize("Standard_DS1_v2").withOsType(OSType.LINUX).withMaxCount(2)
.withMinCount(2).withEnableAutoScaling(true).withOrchestratorVersion("")
.withScaleSetPriority(ScaleSetPriority.SPOT).withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE)
.withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")),
null, null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python agent_pools_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.agent_pools.begin_create_or_update(
resource_group_name="rg1",
resource_name="clustername1",
agent_pool_name="agentpool1",
parameters={
"properties": {
"count": 3,
"enableAutoScaling": True,
"maxCount": 2,
"minCount": 2,
"nodeTaints": ["Key1=Value1:NoSchedule"],
"orchestratorVersion": "",
"osType": "Linux",
"scaleSetEvictionPolicy": "Delete",
"scaleSetPriority": "Spot",
"vmSize": "Standard_DS1_v2",
}
},
).result()
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Update.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Update.json
func ExampleAgentPoolsClient_BeginCreateOrUpdate_updateAgentPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{
Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
Count: to.Ptr[int32](3),
EnableAutoScaling: to.Ptr(true),
MaxCount: to.Ptr[int32](2),
MinCount: to.Ptr[int32](2),
NodeTaints: []*string{
to.Ptr("Key1=Value1:NoSchedule")},
OrchestratorVersion: to.Ptr(""),
OSType: to.Ptr(armcontainerservice.OSTypeLinux),
ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
VMSize: to.Ptr("Standard_DS1_v2"),
},
}, &armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AgentPool = armcontainerservice.AgentPool{
// Name: to.Ptr("agentpool1"),
// Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"),
// Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{
// Count: to.Ptr[int32](3),
// CurrentOrchestratorVersion: to.Ptr("1.9.6"),
// EnableAutoScaling: to.Ptr(true),
// MaxCount: to.Ptr[int32](2),
// MaxPods: to.Ptr[int32](110),
// MinCount: to.Ptr[int32](2),
// NodeTaints: []*string{
// to.Ptr("Key1=Value1:NoSchedule")},
// OrchestratorVersion: to.Ptr("1.9.6"),
// OSType: to.Ptr(armcontainerservice.OSTypeLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// ScaleSetEvictionPolicy: to.Ptr(armcontainerservice.ScaleSetEvictionPolicyDelete),
// ScaleSetPriority: to.Ptr(armcontainerservice.ScaleSetPrioritySpot),
// VMSize: to.Ptr("Standard_DS1_v2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates an agent pool in the specified managed cluster.
*
* @summary Creates or updates an agent pool in the specified managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/AgentPools_Update.json
*/
async function updateAgentPool() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const agentPoolName = "agentpool1";
const parameters = {
count: 3,
enableAutoScaling: true,
maxCount: 2,
minCount: 2,
nodeTaints: ["Key1=Value1:NoSchedule"],
orchestratorVersion: "",
osType: "Linux",
scaleSetEvictionPolicy: "Delete",
scaleSetPriority: "Spot",
vmSize: "Standard_DS1_v2",
};
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.agentPools.beginCreateOrUpdateAndWait(
resourceGroupName,
resourceName,
agentPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Succeeded",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"enableAutoScaling": true,
"minCount": 2,
"maxCount": 2,
"vmSize": "Standard_DS1_v2",
"maxPods": 110,
"osType": "Linux",
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete"
}
}
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1",
"type": "Microsoft.ContainerService/managedClusters/agentPools",
"name": "agentpool1",
"properties": {
"provisioningState": "Updating",
"orchestratorVersion": "1.9.6",
"currentOrchestratorVersion": "1.9.6",
"count": 3,
"enableAutoScaling": true,
"minCount": 2,
"maxCount": 2,
"vmSize": "Standard_DS1_v2",
"maxPods": 110,
"osType": "Linux",
"nodeTaints": [
"Key1=Value1:NoSchedule"
],
"scaleSetPriority": "Spot",
"scaleSetEvictionPolicy": "Delete"
}
}
Définitions
Nom |
Description |
AgentPool
|
Pool d’agents.
|
AgentPoolMode
|
Mode d’un pool d’agents.
|
AgentPoolNetworkProfile
|
Paramètres réseau d’un pool d’agents.
|
AgentPoolSecurityProfile
|
Paramètres de sécurité d’un pool d’agents.
|
AgentPoolType
|
Type de pool d’agents.
|
AgentPoolUpgradeSettings
|
Paramètres de mise à niveau d’un pool d’agents
|
AgentPoolWindowsProfile
|
Profil spécifique du pool d’agents Windows.
|
CloudError
|
Réponse d’erreur du service Conteneur.
|
CloudErrorBody
|
Réponse d’erreur du service Conteneur.
|
code
|
Indique si le cluster est en cours d’exécution ou arrêté
|
CreationData
|
Données utilisées lors de la création d’une ressource cible à partir d’une ressource source.
|
GPUInstanceProfile
|
GPUInstanceProfile à utiliser pour spécifier le profil d’instance GPU MIG pour la référence SKU de machine virtuelle GPU prise en charge.
|
IPTag
|
Contient l’IPTag associé à l’objet.
|
KubeletConfig
|
Configurations Kubelet des nœuds d’agent.
|
KubeletDiskType
|
Détermine le placement des volumes emptyDir, de la racine des données du runtime de conteneur et du stockage éphémère Kubelet.
|
LinuxOSConfig
|
Configurations du système d’exploitation des nœuds d’agent Linux.
|
OSDiskType
|
Type de disque du système d’exploitation à utiliser pour les machines du pool d’agents.
|
OSSKU
|
Spécifie la référence SKU du système d’exploitation utilisée par le pool d’agents. La valeur par défaut est Ubuntu si OSType est Linux. La valeur par défaut est Windows2019 quand Kubernetes <= 1.24 ou Windows2022 quand Kubernetes >= 1.25 si OSType est Windows.
|
OSType
|
Type de système d’exploitation. La valeur par défaut est Linux.
|
PortRange
|
Plage de ports.
|
PowerState
|
Décrit l’état de l’alimentation du cluster
|
Protocol
|
Protocole réseau du port.
|
ScaleDownMode
|
Décrit comment les machines virtuelles sont ajoutées ou supprimées des pools d’agents. Consultez états de facturation.
|
ScaleSetEvictionPolicy
|
Stratégie d’éviction du groupe de machines virtuelles identiques.
|
ScaleSetPriority
|
Priorité du groupe de machines virtuelles identiques.
|
SysctlConfig
|
Paramètres Sysctl pour les nœuds d’agent Linux.
|
WorkloadRuntime
|
Détermine le type de charge de travail qu’un nœud peut exécuter.
|
AgentPool
Pool d’agents.
Nom |
Type |
Valeur par défaut |
Description |
id
|
string
|
|
ID de ressource.
|
name
|
string
|
|
Nom de la ressource unique au sein d’un groupe de ressources. Ce nom peut être utilisé pour accéder à la ressource.
|
properties.availabilityZones
|
string[]
|
|
Liste des zones de disponibilité à utiliser pour les nœuds. Cela ne peut être spécifié que si la propriété AgentPoolType est « VirtualMachineScaleSets ».
|
properties.capacityReservationGroupID
|
string
|
|
ID de ressource complet du groupe de réservations de capacité pour fournir des machines virtuelles à partir d’un groupe réservé de machines virtuelles.
AKS associe le pool d’agents spécifié au groupe de réservations de capacité.
|
properties.count
|
integer
|
|
Nombre d’agents (machines virtuelles) pour héberger des conteneurs Docker. Les valeurs autorisées doivent être comprises entre 0 et 1 000 (inclus) pour les pools d’utilisateurs et dans la plage comprise entre 1 et 1 000 (inclus) pour les pools système. La valeur par défaut est 1.
|
properties.creationData
|
CreationData
|
|
CreationData à utiliser pour spécifier l’ID d’instantané source si le pool de nœuds sera créé/mis à niveau à l’aide d’un instantané.
|
properties.currentOrchestratorVersion
|
string
|
|
La version de Kubernetes du pool d’agents est en cours d’exécution.
Si orchestratorVersion est une version entièrement spécifiée <major.minor.patch>, ce champ est exactement égal à celui-ci. Si orchestratorVersion est <>major.minor, ce champ contient la version complète <major.minor.patch> utilisée.
|
properties.eTag
|
string
|
|
Chaîne en lecture seule unique utilisée pour implémenter l’accès concurrentiel optimiste. La valeur eTag change lorsque la ressource est mise à jour. Spécifiez un en-tête if-match ou if-none-match avec la valeur eTag d’une requête suivante pour activer la concurrence optimiste conformément à la convention etag normale.
|
properties.enableAutoScaling
|
boolean
|
|
Indique s’il faut activer la mise à l’échelle automatique
|
properties.enableEncryptionAtHost
|
boolean
|
|
Indique s’il faut activer le chiffrement du système d’exploitation et du lecteur de données basés sur l’hôte.
Cela n’est pris en charge que sur certaines tailles de machine virtuelle et dans certaines régions Azure. Pour plus d’informations, consultez : https://docs.microsoft.com/azure/aks/enable-host-encryption
|
properties.enableFIPS
|
boolean
|
|
Indique s’il faut utiliser un système d’exploitation compatible FIPS.
Pour plus d’informations, consultez Ajouter un pool de nœuds compatible FIPS.
|
properties.enableNodePublicIP
|
boolean
|
|
Indique si chaque nœud est alloué à sa propre adresse IP publique.
Certains scénarios peuvent nécessiter des nœuds dans un pool de nœuds pour recevoir leurs propres adresses IP publiques dédiées. Un scénario courant concerne les charges de travail de jeu, où une console doit établir une connexion directe à une machine virtuelle cloud afin de réduire les tronçons. Pour plus d’informations, consultez affectation d’une adresse IP publique par nœud. La valeur par défaut est false.
|
properties.enableUltraSSD
|
boolean
|
|
Indique s’il faut activer UltraSSD
|
properties.gpuInstanceProfile
|
GPUInstanceProfile
|
|
GPUInstanceProfile à utiliser pour spécifier le profil d’instance GPU MIG pour la référence SKU de machine virtuelle GPU prise en charge.
|
properties.hostGroupID
|
string
|
|
ID de ressource complet du groupe hôte dédié à partir duquel provisionner des machines virtuelles, utilisé uniquement dans le scénario de création et non autorisé à changer une fois défini.
Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. Pour plus d’informations, consultez hôtes dédiés Azure.
|
properties.kubeletConfig
|
KubeletConfig
|
|
Configurations Kubelet des nœuds d’agent.
Configuration Kubelet sur les nœuds du pool d’agents.
|
properties.kubeletDiskType
|
KubeletDiskType
|
|
Détermine le placement des volumes emptyDir, de la racine des données du runtime de conteneur et du stockage éphémère Kubelet.
|
properties.linuxOSConfig
|
LinuxOSConfig
|
|
Configurations du système d’exploitation des nœuds d’agent Linux.
Configuration du système d’exploitation des nœuds de l’agent Linux.
|
properties.maxCount
|
integer
|
|
Nombre maximal de nœuds pour la mise à l’échelle automatique
|
properties.maxPods
|
integer
|
|
Nombre maximal de pods qui peuvent s’exécuter sur un nœud.
|
properties.minCount
|
integer
|
|
Nombre minimal de nœuds pour la mise à l’échelle automatique
|
properties.mode
|
AgentPoolMode
|
|
Mode d’un pool d’agents.
Un cluster doit avoir au moins un pool d’agents « Système » à tout moment. Pour plus d’informations sur les restrictions de pool d’agents et les meilleures pratiques, consultez : https://docs.microsoft.com/azure/aks/use-system-pools
|
properties.networkProfile
|
AgentPoolNetworkProfile
|
|
Paramètres liés au réseau d’un pool d’agents.
|
properties.nodeImageVersion
|
string
|
|
Version de l’image de nœud
|
properties.nodeLabels
|
object
|
|
Étiquettes de nœud à conserver sur tous les nœuds du pool d’agents.
|
properties.nodePublicIPPrefixID
|
string
|
|
ID de préfixe IP public à partir duquel les nœuds de machine virtuelle doivent utiliser des adresses IP.
Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}
|
properties.nodeTaints
|
string[]
|
|
Les teintes ajoutées aux nouveaux nœuds pendant la création et la mise à l’échelle du pool de nœuds. Par exemple, key=value :NoSchedule.
|
properties.orchestratorVersion
|
string
|
|
Version de Kubernetes spécifiée par l’utilisateur.
Les deux versions de correctif <> major.minor.patch (par exemple, 1.20.13) et <> major.minor (par exemple, 1,20) sont prises en charge. Lorsque <> major.minor est spécifié, la dernière version de correctif ga prise en charge est choisie automatiquement. La mise à jour du cluster avec le même <major.minor> une fois qu’il a été créé (par exemple, 1.14.x -> 1.14) ne déclenche pas de mise à niveau, même si une version de correctif plus récente est disponible. En guise de meilleure pratique, vous devez mettre à niveau tous les pools de nœuds d’un cluster AKS vers la même version de Kubernetes. La version du pool de nœuds doit avoir la même version principale que le plan de contrôle. La version mineure du pool de nœuds doit se trouver dans deux versions mineures de la version du plan de contrôle. La version du pool de nœuds ne peut pas être supérieure à la version du plan de contrôle. Pour plus d’informations, consultez mise à niveau d’un pool de nœuds.
|
properties.osDiskSizeGB
|
integer
|
|
Taille du disque du système d’exploitation en Go à utiliser pour spécifier la taille du disque pour chaque ordinateur du pool maître/agent. Si vous spécifiez 0, elle applique la taille osDisk par défaut en fonction de vmSize spécifiée.
|
properties.osDiskType
|
OSDiskType
|
|
Type de disque du système d’exploitation à utiliser pour les machines du pool d’agents.
La valeur par défaut est « Éphémère » si la machine virtuelle la prend en charge et a un disque de cache supérieur à celui demandé d’OSDiskSizeGB. Sinon, la valeur par défaut est « Gérée ». Peut ne pas être modifié après la création. Pour plus d’informations, consultez système d’exploitation éphémère.
|
properties.osSKU
|
OSSKU
|
|
Spécifie la référence SKU du système d’exploitation utilisée par le pool d’agents. La valeur par défaut est Ubuntu si OSType est Linux. La valeur par défaut est Windows2019 quand Kubernetes <= 1.24 ou Windows2022 quand Kubernetes >= 1.25 si OSType est Windows.
|
properties.osType
|
OSType
|
Linux
|
Type de système d’exploitation. La valeur par défaut est Linux.
|
properties.podSubnetID
|
string
|
|
ID du sous-réseau auquel les pods seront joints lors du lancement.
En cas d’omission, les adresses IP de pod sont affectées statiquement sur le sous-réseau de nœud (voir vnetSubnetID pour plus d’informations). Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
properties.powerState
|
PowerState
|
|
Indique si le pool d’agents est en cours d’exécution ou arrêté.
Lorsqu’un pool d’agents est créé pour la première fois, il est en cours d’exécution. Le pool d’agents peut être arrêté en définissant ce champ sur Arrêté. Un pool d’agents arrêté arrête toutes ses machines virtuelles et n’accumule pas de frais de facturation. Un pool d’agents ne peut être arrêté que s’il est en cours d’exécution et si l’état d’approvisionnement est Réussi
|
properties.provisioningState
|
string
|
|
État actuel du déploiement ou de l’approvisionnement.
|
properties.proximityPlacementGroupID
|
string
|
|
ID du groupe de placement de proximité.
|
properties.scaleDownMode
|
ScaleDownMode
|
|
Mode scale-down à utiliser lors de la mise à l’échelle du pool d’agents.
Cela affecte également le comportement du générateur de mise à l’échelle automatique du cluster. S’il n’est pas spécifié, il est défini par défaut sur Delete.
|
properties.scaleSetEvictionPolicy
|
ScaleSetEvictionPolicy
|
Delete
|
Stratégie d’éviction du groupe de machines virtuelles identiques à utiliser.
Cela ne peut pas être spécifié, sauf si scaleSetPriority est « Spot ». S’il n’est pas spécifié, la valeur par défaut est « Supprimer ».
|
properties.scaleSetPriority
|
ScaleSetPriority
|
Regular
|
Priorité du groupe de machines virtuelles identiques. S’il n’est pas spécifié, la valeur par défaut est « Standard ».
|
properties.securityProfile
|
AgentPoolSecurityProfile
|
|
Paramètres de sécurité d’un pool d’agents.
|
properties.spotMaxPrice
|
number
|
-1
|
Le prix maximal (en dollars AMÉRICAINs) que vous êtes prêt à payer pour les instances spot. Les valeurs possibles sont toutes les valeurs décimales supérieures à zéro ou -1 qui indiquent le prix par défaut up-to à la demande.
Les valeurs possibles sont une valeur décimale supérieure à zéro ou -1 qui indique la volonté de payer n’importe quel prix à la demande. Pour plus d’informations sur la tarification spot, consultez tarification des machines virtuelles spot
|
properties.tags
|
object
|
|
Balises à conserver sur le groupe de machines virtuelles identiques du pool d’agents.
|
properties.type
|
AgentPoolType
|
|
Type de pool d’agents.
|
properties.upgradeSettings
|
AgentPoolUpgradeSettings
|
|
Paramètres de mise à niveau du pool d’agents
|
properties.vmSize
|
string
|
|
Taille des machines virtuelles du pool d’agents.
La disponibilité de la taille des machines virtuelles varie selon la région. Si un nœud contient des ressources de calcul insuffisantes (mémoire, processeur, etc.) les pods peuvent échouer à s’exécuter correctement. Pour plus d’informations sur les tailles de machine virtuelle restreintes, consultez : https://docs.microsoft.com/azure/aks/quotas-skus-regions
|
properties.vnetSubnetID
|
string
|
|
ID du sous-réseau sur lequel les nœuds du pool d’agents et éventuellement les pods se joignent au démarrage.
Si ce n’est pas spécifié, un réseau virtuel et un sous-réseau sont générés et utilisés. Si aucun podSubnetID n’est spécifié, cela s’applique aux nœuds et aux pods, sinon il s’applique uniquement aux nœuds. Il s’agit de la forme suivante : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
|
properties.windowsProfile
|
AgentPoolWindowsProfile
|
|
Profil spécifique du pool d’agents Windows.
|
properties.workloadRuntime
|
WorkloadRuntime
|
|
Détermine le type de charge de travail qu’un nœud peut exécuter.
|
type
|
string
|
|
Type de ressource
|
AgentPoolMode
Mode d’un pool d’agents.
Nom |
Type |
Description |
System
|
string
|
Les pools d’agents système sont principalement destinés à héberger des pods système critiques tels que CoreDNS et metrics-server. Les pools d’agents système osType doivent être Linux. La référence SKU de machine virtuelle des pools d’agents système doit avoir au moins 2 processeurs virtuels et 4 Go de mémoire.
|
User
|
string
|
Les pools d’agents utilisateur sont principalement destinés à héberger vos pods d’application.
|
AgentPoolNetworkProfile
Paramètres réseau d’un pool d’agents.
Nom |
Type |
Description |
allowedHostPorts
|
PortRange[]
|
Plages de ports autorisées à accéder. Les plages spécifiées sont autorisées à se chevaucher.
|
applicationSecurityGroups
|
string[]
|
ID des groupes de sécurité d’application associés au pool d’agents lors de la création.
|
nodePublicIPTags
|
IPTag[]
|
IPTags d’adresses IP publiques au niveau de l’instance.
|
AgentPoolSecurityProfile
Paramètres de sécurité d’un pool d’agents.
Nom |
Type |
Description |
enableSecureBoot
|
boolean
|
Le démarrage sécurisé est une fonctionnalité de lancement approuvé qui garantit que seuls les systèmes d’exploitation signés et les pilotes peuvent démarrer. Pour plus d’informations, consultez aka.ms/aks/trustedlaunch. S’il n’est pas spécifié, la valeur par défaut est false.
|
enableVTPM
|
boolean
|
vTPM est une fonctionnalité de lancement approuvé permettant de configurer un coffre sécurisé dédié pour les clés et les mesures conservées localement sur le nœud. Pour plus d’informations, consultez aka.ms/aks/trustedlaunch. S’il n’est pas spécifié, la valeur par défaut est false.
|
AgentPoolType
Type de pool d’agents.
Nom |
Type |
Description |
AvailabilitySet
|
string
|
L’utilisation de ce problème est fortement déconseillée.
|
VirtualMachineScaleSets
|
string
|
Créez un pool d’agents soutenu par un groupe de machines virtuelles identiques.
|
AgentPoolUpgradeSettings
Paramètres de mise à niveau d’un pool d’agents
Nom |
Type |
Description |
drainTimeoutInMinutes
|
integer
|
Délai d’expiration du drainage pour un nœud
Durée (en minutes) d’attente de l’éviction des pods et de l’arrêt approprié par nœud. Ce temps d’attente d’éviction respecte les budgets d’interruption des pods. Si cette durée est dépassée, la mise à niveau échoue. Si ce n’est pas spécifié, la valeur par défaut est de 30 minutes.
|
maxSurge
|
string
|
Nombre maximal ou pourcentage de nœuds qui sont augmentés pendant la mise à niveau.
Cela peut être défini sur un entier (par exemple, « 5 ») ou sur un pourcentage (par exemple, « 50%»). Si un pourcentage est spécifié, il s’agit du pourcentage de la taille totale du pool d’agents au moment de la mise à niveau. Pour les pourcentages, les nœuds fractionnaires sont arrondis. S’il n’est pas spécifié, la valeur par défaut est 1. Pour plus d’informations, notamment les meilleures pratiques, consultez : https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade
|
nodeSoakDurationInMinutes
|
integer
|
Durée d’imbibage d’un nœud
Durée (en minutes) d’attente après le drainage d’un nœud et avant de la réimager et passer au nœud suivant. S’il n’est pas spécifié, la valeur par défaut est de 0 minutes.
|
AgentPoolWindowsProfile
Profil spécifique du pool d’agents Windows.
Nom |
Type |
Description |
disableOutboundNat
|
boolean
|
Indique s’il faut désactiver OutboundNAT dans les nœuds Windows
La valeur par défaut est false. La nat sortante ne peut être désactivée que si le type de trafic sortant du cluster est une passerelle NAT et que le pool d’agents Windows n’a pas d’adresse IP publique de nœud activée.
|
CloudError
Réponse d’erreur du service Conteneur.
CloudErrorBody
Réponse d’erreur du service Conteneur.
Nom |
Type |
Description |
code
|
string
|
Identificateur de l’erreur. Les codes sont invariants et sont destinés à être consommés par programme.
|
details
|
CloudErrorBody[]
|
Liste des détails supplémentaires sur l’erreur.
|
message
|
string
|
Message décrivant l’erreur, destiné à être adapté à l’affichage dans une interface utilisateur.
|
target
|
string
|
Cible de l’erreur particulière. Par exemple, le nom de la propriété en erreur.
|
code
Indique si le cluster est en cours d’exécution ou arrêté
Nom |
Type |
Description |
Running
|
string
|
Le cluster est en cours d’exécution.
|
Stopped
|
string
|
Le cluster est arrêté.
|
CreationData
Données utilisées lors de la création d’une ressource cible à partir d’une ressource source.
Nom |
Type |
Description |
sourceResourceId
|
string
|
Il s’agit de l’ID ARM de l’objet source à utiliser pour créer l’objet cible.
|
GPUInstanceProfile
GPUInstanceProfile à utiliser pour spécifier le profil d’instance GPU MIG pour la référence SKU de machine virtuelle GPU prise en charge.
Nom |
Type |
Description |
MIG1g
|
string
|
|
MIG2g
|
string
|
|
MIG3g
|
string
|
|
MIG4g
|
string
|
|
MIG7g
|
string
|
|
IPTag
Contient l’IPTag associé à l’objet.
Nom |
Type |
Description |
ipTagType
|
string
|
Type d’étiquette IP. Exemple : RoutingPreference.
|
tag
|
string
|
Valeur de la balise IP associée à l’adresse IP publique. Exemple : Internet.
|
KubeletConfig
Configurations Kubelet des nœuds d’agent.
Nom |
Type |
Description |
allowedUnsafeSysctls
|
string[]
|
Liste autorisée de sysctls non sécurisés ou de modèles sysctl non sécurisés (se terminant par * ).
|
containerLogMaxFiles
|
integer
|
Nombre maximal de fichiers journaux de conteneur pouvant être présents pour un conteneur. Le nombre doit être ≥ 2.
|
containerLogMaxSizeMB
|
integer
|
Taille maximale (par exemple, 10Mi) du fichier journal conteneur avant sa rotation.
|
cpuCfsQuota
|
boolean
|
Si l’application du quota CFS du processeur est activée pour les conteneurs qui spécifient des limites d’UC.
La valeur par défaut est true.
|
cpuCfsQuotaPeriod
|
string
|
Valeur de la période de quota CFS du processeur.
La valeur par défaut est « 100ms ». Les valeurs valides sont une séquence de nombres décimaux avec une fraction facultative et un suffixe d’unité. Par exemple : « 300ms », « 2h45m ». Les unités prises en charge sont « ns », « us », « ms », « s », « m » et « h ».
|
cpuManagerPolicy
|
string
|
Stratégie du Gestionnaire d’UC à utiliser.
La valeur par défaut est « none ». Pour plus d’informations, consultez stratégies de gestion du processeur Kubernetes. Les valeurs autorisées sont « none » et « static ».
|
failSwapOn
|
boolean
|
Si la valeur est true, kubelet ne démarre pas si l’échange est activé sur le nœud.
|
imageGcHighThreshold
|
integer
|
Pourcentage d’utilisation du disque après laquelle le garbage collection d’images est toujours exécuté.
Pour désactiver le garbage collection d’images, définissez sur 100. La valeur par défaut est 85%
|
imageGcLowThreshold
|
integer
|
Pourcentage d’utilisation du disque avant laquelle le garbage collection d’images n’est jamais exécuté.
Cela ne peut pas être défini plus haut que imageGcHighThreshold. La valeur par défaut est 80%
|
podMaxPids
|
integer
|
Nombre maximal de processus par pod.
|
topologyManagerPolicy
|
string
|
Stratégie du Gestionnaire de topologie à utiliser.
Pour plus d’informations, consultez Gestionnaire de topologie Kubernetes. La valeur par défaut est « none ». Les valeurs autorisées sont « none », « best-effort », « restricted » et « single-numa-node ».
|
KubeletDiskType
Détermine le placement des volumes emptyDir, de la racine des données du runtime de conteneur et du stockage éphémère Kubelet.
Nom |
Type |
Description |
OS
|
string
|
Kubelet utilisera le disque du système d’exploitation pour ses données.
|
Temporary
|
string
|
Kubelet utilisera le disque temporaire pour ses données.
|
LinuxOSConfig
Configurations du système d’exploitation des nœuds d’agent Linux.
Nom |
Type |
Description |
swapFileSizeMB
|
integer
|
Taille en Mo d’un fichier d’échange qui sera créé sur chaque nœud.
|
sysctls
|
SysctlConfig
|
Paramètres Sysctl pour les nœuds d’agent Linux.
|
transparentHugePageDefrag
|
string
|
Indique si le noyau doit utiliser agressivement le compactage de la mémoire pour rendre plus énormes pages disponibles.
Les valeurs valides sont « always », « defer », « defer+madvise », « madvise » et « never ». La valeur par défaut est « madvise ». Pour plus d’informations, consultez Transparent Hugepages.
|
transparentHugePageEnabled
|
string
|
Indique si les énormes pages transparentes sont activées.
Les valeurs valides sont « always », « madvise » et « never ». La valeur par défaut est « always ». Pour plus d’informations, consultez Transparent Hugepages.
|
OSDiskType
Type de disque du système d’exploitation à utiliser pour les machines du pool d’agents.
Nom |
Type |
Description |
Ephemeral
|
string
|
Les disques de système d’exploitation éphémères sont stockés uniquement sur la machine hôte, comme un disque temporaire. Cela fournit une latence de lecture/écriture inférieure, ainsi que des mises à niveau de nœud et de cluster plus rapides.
|
Managed
|
string
|
Azure réplique le disque du système d’exploitation d’une machine virtuelle vers le stockage Azure pour éviter toute perte de données si la machine virtuelle doit être déplacée vers un autre hôte. Étant donné que les conteneurs ne sont pas conçus pour conserver l’état local, ce comportement offre une valeur limitée tout en fournissant certains inconvénients, notamment l’approvisionnement de nœuds lent et une latence de lecture/écriture plus élevée.
|
OSSKU
Spécifie la référence SKU du système d’exploitation utilisée par le pool d’agents. La valeur par défaut est Ubuntu si OSType est Linux. La valeur par défaut est Windows2019 quand Kubernetes <= 1.24 ou Windows2022 quand Kubernetes >= 1.25 si OSType est Windows.
Nom |
Type |
Description |
AzureLinux
|
string
|
Utilisez AzureLinux comme système d’exploitation pour les images de nœud. Azure Linux est une distribution Linux optimisée par conteneur créée par Microsoft, visitez https://aka.ms/azurelinux pour plus d’informations.
|
CBLMariner
|
string
|
Référence OSSKU déconseillée. Microsoft recommande que les nouveaux déploiements choisissent « AzureLinux » à la place.
|
Ubuntu
|
string
|
Utilisez Ubuntu comme système d’exploitation pour les images de nœud.
|
Windows2019
|
string
|
Utilisez Windows2019 comme système d’exploitation pour les images de nœud. Non pris en charge pour les pools de nœuds système. Windows2019 prend uniquement en charge les conteneurs Windows2019 ; il ne peut pas exécuter les conteneurs Windows2022 et vice versa.
|
Windows2022
|
string
|
Utilisez Windows2022 comme système d’exploitation pour les images de nœud. Non pris en charge pour les pools de nœuds système. Windows2022 prend uniquement en charge les conteneurs Windows2022 ; il ne peut pas exécuter les conteneurs Windows2019 et vice versa.
|
OSType
Type de système d’exploitation. La valeur par défaut est Linux.
Nom |
Type |
Description |
Linux
|
string
|
Utilisez Linux.
|
Windows
|
string
|
Utilisez Windows.
|
PortRange
Plage de ports.
Nom |
Type |
Description |
portEnd
|
integer
|
Port maximal inclus dans la plage. Elle doit être comprise entre 1 et 65535, et être supérieure ou égale à portStart.
|
portStart
|
integer
|
Port minimal inclus dans la plage. Elle doit être comprise entre 1 et 65535, et être inférieure ou égale à portEnd.
|
protocol
|
Protocol
|
Protocole réseau du port.
|
PowerState
Décrit l’état de l’alimentation du cluster
Nom |
Type |
Description |
code
|
code
|
Indique si le cluster est en cours d’exécution ou arrêté
|
Protocol
Protocole réseau du port.
Nom |
Type |
Description |
TCP
|
string
|
Protocole TCP.
|
UDP
|
string
|
Protocole UDP.
|
ScaleDownMode
Décrit comment les machines virtuelles sont ajoutées ou supprimées des pools d’agents. Consultez états de facturation.
Nom |
Type |
Description |
Deallocate
|
string
|
Essayez de démarrer des instances libérées (le cas échéant) pendant le scale-up et la libération des instances lors d’un scale-down.
|
Delete
|
string
|
Créez de nouvelles instances pendant le scale-up et supprimez des instances lors d’un scale-down.
|
ScaleSetEvictionPolicy
Stratégie d’éviction du groupe de machines virtuelles identiques.
Nom |
Type |
Description |
Deallocate
|
string
|
Les nœuds du groupe identique sous-jacent du pool de nœuds sont définis sur l’état arrêté-désalloué lors de l’éviction. Les nœuds dans le nombre d’états désalloués arrêtés par rapport à votre quota de calcul peuvent entraîner des problèmes de mise à l’échelle ou de mise à niveau de cluster.
|
Delete
|
string
|
Les nœuds du groupe identique sous-jacent du pool de nœuds sont supprimés lorsqu’ils sont supprimés.
|
ScaleSetPriority
Priorité du groupe de machines virtuelles identiques.
Nom |
Type |
Description |
Regular
|
string
|
Les machines virtuelles régulières seront utilisées.
|
Spot
|
string
|
Les machines virtuelles de priorité Spot seront utilisées. Il n’existe aucun contrat SLA pour les nœuds spot. Pour plus d’informations, consultez spot sur AKS.
|
SysctlConfig
Paramètres Sysctl pour les nœuds d’agent Linux.
Nom |
Type |
Description |
fsAioMaxNr
|
integer
|
Paramètre Sysctl fs.aio-max-nr.
|
fsFileMax
|
integer
|
Paramètre Sysctl fs.file-max.
|
fsInotifyMaxUserWatches
|
integer
|
Paramètre Sysctl fs.inotify.max_user_watch.
|
fsNrOpen
|
integer
|
Paramètre Sysctl fs.nr_open.
|
kernelThreadsMax
|
integer
|
Sysctl définissant kernel.threads-max.
|
netCoreNetdevMaxBacklog
|
integer
|
Paramètre Sysctl net.core.netdev_max_backlog.
|
netCoreOptmemMax
|
integer
|
Paramètre Sysctl net.core.optmem_max.
|
netCoreRmemDefault
|
integer
|
Paramètre Sysctl net.core.rmem_default.
|
netCoreRmemMax
|
integer
|
Paramètre Sysctl net.core.rmem_max.
|
netCoreSomaxconn
|
integer
|
Sysctl définissant net.core.somaxconn.
|
netCoreWmemDefault
|
integer
|
Paramètre Sysctl net.core.wmem_default.
|
netCoreWmemMax
|
integer
|
Paramètre Sysctl net.core.wmem_max.
|
netIpv4IpLocalPortRange
|
string
|
Paramètre Sysctl net.ipv4.ip_local_port_range.
|
netIpv4NeighDefaultGcThresh1
|
integer
|
Paramètre Sysctl net.ipv4.neigh.default.gc_thresh1.
|
netIpv4NeighDefaultGcThresh2
|
integer
|
Paramètre Sysctl net.ipv4.neigh.default.gc_thresh2.
|
netIpv4NeighDefaultGcThresh3
|
integer
|
Paramètre Sysctl net.ipv4.neigh.default.gc_thresh3.
|
netIpv4TcpFinTimeout
|
integer
|
Paramètre Sysctl net.ipv4.tcp_fin_timeout.
|
netIpv4TcpKeepaliveProbes
|
integer
|
Paramètre Sysctl net.ipv4.tcp_keepalive_probes.
|
netIpv4TcpKeepaliveTime
|
integer
|
Paramètre Sysctl net.ipv4.tcp_keepalive_time.
|
netIpv4TcpMaxSynBacklog
|
integer
|
Paramètre Sysctl net.ipv4.tcp_max_syn_backlog.
|
netIpv4TcpMaxTwBuckets
|
integer
|
Paramètre Sysctl net.ipv4.tcp_max_tw_buckets.
|
netIpv4TcpTwReuse
|
boolean
|
Paramètre Sysctl net.ipv4.tcp_tw_reuse.
|
netIpv4TcpkeepaliveIntvl
|
integer
|
Paramètre Sysctl net.ipv4.tcp_keepalive_intvl.
|
netNetfilterNfConntrackBuckets
|
integer
|
Paramètre Sysctl net.netfilter.nf_conntrack_buckets.
|
netNetfilterNfConntrackMax
|
integer
|
Paramètre Sysctl net.netfilter.nf_conntrack_max.
|
vmMaxMapCount
|
integer
|
Paramètre Sysctl vm.max_map_count.
|
vmSwappiness
|
integer
|
Sysctl définissant vm.swappiness.
|
vmVfsCachePressure
|
integer
|
Paramètre Sysctl vm.vfs_cache_pressure.
|
WorkloadRuntime
Détermine le type de charge de travail qu’un nœud peut exécuter.
Nom |
Type |
Description |
OCIContainer
|
string
|
Les nœuds utilisent Kubelet pour exécuter des charges de travail de conteneur OCI standard.
|
WasmWasi
|
string
|
Les nœuds utilisent Krustlet pour exécuter des charges de travail WASM à l’aide du fournisseur WASI (préversion).
|