- Azure Resource Manager テンプレートを使用して Azure Nexus Kubernetes クラスターをデプロイします。
このクイック スタートでは、Azure Resource Manager テンプレート (ARM テンプレート) を使用して Azure Nexus Kubernetes クラスターを作成する方法について説明します。
Azure Resource Manager テンプレートは、プロジェクトのインフラストラクチャと構成を定義する JavaScript Object Notation (JSON) ファイルです。 このテンプレートでは、宣言型の構文が使用されています。 デプロイを作成するための一連のプログラミング コマンドを記述しなくても、意図したデプロイを記述できます。
[前提条件]
Azure アカウントをお持ちでない場合は、開始する前に無料アカウントを作成してください。
Azure Cloud Shell で Bash 環境を使用します。 詳細については、「Azure Cloud Shell の概要」を参照してください。
CLI 参照コマンドをローカルで実行する場合は、Azure CLI を インストール します。 Windows または macOS で実行している場合は、Docker コンテナーで Azure CLI を実行することを検討してください。 詳細については、「Docker コンテナーで Azure CLI を実行する方法」を参照してください。
ローカル インストールを使用する場合は、az login コマンドを使用して Azure CLI にサインインします。 認証プロセスを完了するには、ターミナルに表示される手順に従います。 その他のサインイン オプションについては、「 Azure CLI を使用した Azure への認証」を参照してください。
メッセージが表示されたら、最初に使用するときに Azure CLI 拡張機能をインストールします。 拡張機能の詳細については、「Azure CLI で拡張機能を使用および管理する」を参照してください。
az version を実行し、インストールされているバージョンおよび依存ライブラリを検索します。 最新バージョンにアップグレードするには、az upgrade を実行します。
必要な Azure CLI 拡張機能の最新バージョンをインストールします。
この記事では、Azure CLI のバージョン 2.61.0 以降が必要です。 Azure Cloud Shell を使用している場合は、最新バージョンが既にインストールされています。
複数の Azure サブスクリプションをお持ちの場合は、
az account
コマンドを使用して、リソースを課金する適切なサブスクリプション ID を選択してください。サポートされている VM SKU のリストについては、参照セクションの VM SKU の表を参照してください。
サポートされている Kubernetes バージョンの一覧については、サポートされている Kubernetes バージョンに関するページを参照してください。
az group create
コマンドを使用してリソース グループを作成します。 Azure リソース グループは、Azure リソースが展開され管理される論理グループです。 リソース グループを作成する際は、場所の指定を求めるプロンプトが表示されます。 この場所は、リソース グループのメタデータが格納される場所です。また、リソースの作成時に別のリージョンを指定しない場合は、Azure でリソースが実行される場所でもあります。 次の例では、 myResourceGroup という名前のリソース グループを eastus の場所に作成します。az group create --name myResourceGroup --___location eastus
リソース グループが正常に作成された場合の出力の例は、次のようになります。
{ "id": "/subscriptions/<guid>/resourceGroups/myResourceGroup", "___location": "eastus", "managedBy": null, "name": "myResourceGroup", "properties": { "provisioningState": "Succeeded" }, "tags": null }
Bicep ファイルまたは ARM テンプレートをデプロイするには、デプロイ対象のリソースに対する書き込みアクセス権が必要であり、さらに、Microsoft.Resources/deployments リソース タイプでのすべての操作に対するアクセス権が必要です。 たとえば、クラスターをデプロイするには、Microsoft.NetworkCloud/kubernetesclusters/write および Microsoft.Resources/deployments/* アクセス許可が必要です。 ロールとアクセス許可の一覧については、Azure の組み込みロールに関するページを参照してください。
Azure Operator Nexus クラスターの
custom ___location
リソース ID が必要です。特定のワークロード要件に従ってさまざまなネットワークを作成する必要があり、ワークロードに適切な IP アドレスを使用できるようにすることが重要です。 円滑な実装を行うには、関連するサポート チームに問い合わせて支援を求めることをお勧めします。
このクイックスタートは、Kubernetes の基本的な概念を理解していることを前提としています。 詳細については、「Azure Kubernetes Services (AKS) における Kubernetes の中心概念」を参照してください。
テンプレートを確認する
Kubernetes テンプレートをデプロイする前に、その構造を理解するためにコンテンツを確認しましょう。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"kubernetesClusterName": {
"type": "string",
"metadata": {
"description": "The name of Nexus Kubernetes cluster"
}
},
"___location": {
"type": "string",
"metadata": {
"description": "The Azure region where the cluster is to be deployed"
},
"defaultValue": "[resourceGroup().___location]"
},
"extendedLocation": {
"type": "string",
"metadata": {
"description": "The custom ___location of the Nexus instance"
},
"defaultValue": ""
},
"tags": {
"type": "object",
"metadata": {
"description": "The metadata tags to be associated with the cluster resource"
},
"defaultValue": {}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "The username for the administrative account on the cluster"
},
"defaultValue": "azureuser"
},
"adminGroupObjectIds": {
"type": "array",
"metadata": {
"description": "The object IDs of Azure Active Directory (AAD) groups that will have administrative access to the cluster"
},
"defaultValue": []
},
"cniNetworkId": {
"type": "string",
"metadata": {
"description": "The Azure Resource Manager (ARM) id of the network to be used as the Container Networking Interface (CNI) network"
}
},
"cloudServicesNetworkId": {
"type": "string",
"metadata": {
"description": "The ARM id of the network to be used for cloud services network"
}
},
"podCidrs": {
"type": "array",
"metadata": {
"description": "The CIDR blocks used for Nexus Kubernetes PODs in the cluster"
},
"defaultValue": ["10.244.0.0/16"]
},
"serviceCidrs": {
"type": "array",
"metadata": {
"description": "The CIDR blocks used for k8s service in the cluster"
},
"defaultValue": ["10.96.0.0/16"]
},
"dnsServiceIp": {
"type": "string",
"metadata": {
"description": "The IP address of the DNS service in the cluster"
},
"defaultValue": "10.96.0.10"
},
"agentPoolL2Networks": {
"type": "array",
"metadata": {
"description": "The Layer 2 networks associated with the initial agent pool"
},
"defaultValue": []
/*
{
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN"
}
*/
},
"agentPoolL3Networks": {
"type": "array",
"metadata": {
"description": "The Layer 3 networks associated with the initial agent pool"
},
"defaultValue": []
/*
{
"ipamEnabled": "True/False",
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN|IPVLAN"
}
*/
},
"agentPoolTrunkedNetworks": {
"type": "array",
"metadata": {
"description": "The trunked networks associated with the initial agent pool"
},
"defaultValue": []
/*
{
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN"
}
*/
},
"l2Networks": {
"type": "array",
"metadata": {
"description": "The Layer 2 networks associated with the cluster"
},
"defaultValue": []
/*
{
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN"
}
*/
},
"l3Networks": {
"type": "array",
"metadata": {
"description": "The Layer 3 networks associated with the cluster"
},
"defaultValue": []
/*
{
"ipamEnabled": "True/False",
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN|IPVLAN"
}
*/
},
"trunkedNetworks": {
"type": "array",
"metadata": {
"description": "The trunked networks associated with the cluster"
},
"defaultValue": []
/*
{
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN"
}
*/
},
"ipAddressPools": {
"type": "array",
"metadata": {
"description": "The LoadBalancer IP address pools associated with the cluster"
},
"defaultValue": []
/*
{
"addresses": [
"string"
],
"autoAssign": "True/False",
"name": "sting",
"onlyUseHostIps": "True/False"
}
*/
},
"fabricPeeringEnabled": {
"type": "string",
"metadata": {
"description": "The indicator to specify if the load balancer peers with the network fabric."
},
"defaultValue": "True"
},
"bgpAdvertisements": {
"type": "array",
"metadata": {
"description": "The association of IP address pools to the communities and peers, allowing for announcement of IPs."
},
"defaultValue": []
/*
{
"advertiseToFabric": "True/False",
"communities": [
"string"
],
"ipAddressPools": [
"string"
],
"pools": [
"string"
]
}
*/
},
"bgpPeers": {
"type": "array",
"metadata": {
"description": "The list of additional BgpPeer entities that the Kubernetes cluster will peer with. All peering must be explicitly defined."
},
"defaultValue": []
/*
{
"bfdEnabled": "True/False",
"bgpMultiHop": "True/False",
"myAsn": 0-4294967295,
"name": "string",
"password": "string",
"peerAddress": "string",
"peerPort": 179
}
*/
},
"kubernetesVersion": {
"type": "string",
"metadata": {
"description": "The version of Kubernetes to be used in the Nexus Kubernetes cluster"
},
"defaultValue": "v1.27.1"
},
"controlPlaneCount": {
"type": "int",
"metadata": {
"description": "The number of control plane nodes to be deployed in the cluster"
},
"defaultValue": 1
},
"controlPlaneZones": {
"type": "array",
"metadata": {
"description": "The zones/racks used for placement of the control plane nodes"
},
"defaultValue": []
/* array of strings Example: ["1", "2", "3"] */
},
"agentPoolZones": {
"type": "array",
"metadata": {
"description": "The zones/racks used for placement of the agent pool nodes"
},
"defaultValue": []
/* array of strings Example: ["1", "2", "3"] */
},
"controlPlaneVmSkuName": {
"type": "string",
"metadata": {
"description": "The size of the control plane nodes"
},
"defaultValue": "NC_G6_28_v1"
},
"systemPoolNodeCount": {
"type": "int",
"metadata": {
"description": "The number of worker nodes to be deployed in the initial agent pool"
},
"defaultValue": 1
},
"workerVmSkuName": {
"type": "string",
"metadata": {
"description": "The size of the worker nodes"
},
"defaultValue": "NC_P10_56_v1"
},
"initialPoolAgentOptions": {
"type": "object",
"metadata": {
"description": "The configurations for the initial agent pool"
},
"defaultValue": {}
/*
"hugepagesCount": int,
"hugepagesSize": "2M/1G"
*/
},
"sshPublicKeys": {
"type": "array",
"metadata": {
"description": "The cluster wide SSH public key that will be associated with the given user for secure remote login"
},
"defaultValue": []
/*
{
"keyData": "ssh-rsa AAAAA...."
},
{
"keyData": "ssh-rsa BBBBB...."
}
*/
},
"controlPlaneSshKeys": {
"type": "array",
"metadata": {
"description": "The control plane SSH public key that will be associated with the given user for secure remote login"
},
"defaultValue": []
/*
{
"keyData": "ssh-rsa AAAAA...."
},
{
"keyData": "ssh-rsa BBBBB...."
}
*/
},
"agentPoolSshKeys": {
"type": "array",
"metadata": {
"description": "The agent pool SSH public key that will be associated with the given user for secure remote login"
},
"defaultValue": []
/*
{
"keyData": "ssh-rsa AAAAA...."
},
{
"keyData": "ssh-rsa BBBBB...."
}
*/
},
"labels": {
"type": "array",
"metadata": {
"description": "The labels to assign to the nodes in the cluster for identification and organization"
},
"defaultValue": []
/*
{
"key": "string",
"value": "string"
}
*/
},
"taints": {
"type": "array",
"metadata": {
"description": "The taints to apply to the nodes in the cluster to restrict which pods can be scheduled on them"
},
"defaultValue": []
/*
{
"key": "string",
"value": "string:NoSchedule|PreferNoSchedule|NoExecute"
}
*/
}
},
"resources": [
{
"type": "Microsoft.NetworkCloud/kubernetesClusters",
"apiVersion": "2025-02-01",
"name": "[parameters('kubernetesClusterName')]",
"___location": "[parameters('___location')]",
"tags": "[parameters('tags')]",
"extendedLocation": {
"name": "[parameters('extendedLocation')]",
"type": "CustomLocation"
},
"properties": {
"kubernetesVersion": "[parameters('kubernetesVersion')]",
"managedResourceGroupConfiguration": {
"name": "[concat(uniqueString(resourceGroup().name), '-', parameters('kubernetesClusterName'))]",
"___location": "[parameters('___location')]"
},
"aadConfiguration": {
"adminGroupObjectIds": "[parameters('adminGroupObjectIds')]"
},
"administratorConfiguration": {
"adminUsername": "[parameters('adminUsername')]",
"sshPublicKeys": "[if(empty(parameters('sshPublicKeys')), createArray(), parameters('sshPublicKeys'))]"
},
"initialAgentPoolConfigurations": [
{
"name": "[concat(parameters('kubernetesClusterName'), '-nodepool-1')]",
"administratorConfiguration": {
"adminUsername": "[parameters('adminUsername')]",
"sshPublicKeys": "[if(empty(parameters('agentPoolSshKeys')), createArray(), parameters('agentPoolSshKeys'))]"
},
"count": "[parameters('systemPoolNodeCount')]",
"vmSkuName": "[parameters('workerVmSkuName')]",
"mode": "System",
"labels": "[if(empty(parameters('labels')), json('null'), parameters('labels'))]",
"taints": "[if(empty(parameters('taints')), json('null'), parameters('taints'))]",
"agentOptions": "[if(empty(parameters('initialPoolAgentOptions')), json('null'), parameters('initialPoolAgentOptions'))]",
"attachedNetworkConfiguration": {
"l2Networks": "[if(empty(parameters('agentPoolL2Networks')), json('null'), parameters('agentPoolL2Networks'))]",
"l3Networks": "[if(empty(parameters('agentPoolL3Networks')), json('null'), parameters('agentPoolL3Networks'))]",
"trunkedNetworks": "[if(empty(parameters('agentPoolTrunkedNetworks')), json('null'), parameters('agentPoolTrunkedNetworks'))]"
},
"availabilityZones": "[if(empty(parameters('agentPoolZones')), json('null'), parameters('agentPoolZones'))]",
"upgradeSettings": {
"maxSurge": "1"
}
}
],
"controlPlaneNodeConfiguration": {
"administratorConfiguration": {
"adminUsername": "[parameters('adminUsername')]",
"sshPublicKeys": "[if(empty(parameters('controlPlaneSshKeys')), createArray(), parameters('controlPlaneSshKeys'))]"
},
"count": "[parameters('controlPlaneCount')]",
"vmSkuName": "[parameters('controlPlaneVmSkuName')]",
"availabilityZones": "[if(empty(parameters('controlPlaneZones')), json('null'), parameters('controlPlaneZones'))]"
},
"networkConfiguration": {
"cniNetworkId": "[parameters('cniNetworkId')]",
"cloudServicesNetworkId": "[parameters('cloudServicesNetworkId')]",
"dnsServiceIp": "[parameters('dnsServiceIp')]",
"podCidrs": "[parameters('podCidrs')]",
"serviceCidrs": "[parameters('serviceCidrs')]",
"attachedNetworkConfiguration": {
"l2Networks": "[if(empty(parameters('l2Networks')), json('null'), parameters('l2Networks'))]",
"l3Networks": "[if(empty(parameters('l3Networks')), json('null'), parameters('l3Networks'))]",
"trunkedNetworks": "[if(empty(parameters('trunkedNetworks')), json('null'), parameters('trunkedNetworks'))]"
},
"bgpServiceLoadBalancerConfiguration": {
"ipAddressPools": "[if(empty(parameters('ipAddressPools')), json('null'), parameters('ipAddressPools'))]",
"fabricPeeringEnabled": "[if(empty(parameters('fabricPeeringEnabled')), json('null'), parameters('fabricPeeringEnabled'))]",
"bgpAdvertisements": "[if(empty(parameters('bgpAdvertisements')), json('null'), parameters('bgpAdvertisements'))]",
"bgpPeers": "[if(empty(parameters('bgpPeers')), json('null'), parameters('bgpPeers'))]"
}
}
}
}
]
}
kubernetes-deploy.json
という名前のテンプレート ファイルを確認して保存したら、次のセクションに進んでテンプレートをデプロイします。
テンプレートをデプロイする
-
kubernetes-deploy-parameters.json
という名前のファイルを作成し、必要なパラメーターを JSON 形式で追加します。 開始点として、次の例を使用できます。 値は実際の値に置き換えてください。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"kubernetesClusterName":{
"value": "myNexusK8sCluster"
},
"adminGroupObjectIds": {
"value": [
"00000000-0000-0000-0000-000000000000"
]
},
"cniNetworkId": {
"value": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.NetworkCloud/l3Networks/<l3Network-name>"
},
"cloudServicesNetworkId": {
"value": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.NetworkCloud/cloudServicesNetworks/<csn-name>"
},
"extendedLocation": {
"value": "/subscriptions/<subscription_id>/resourceGroups/<managed_resource_group>/providers/microsoft.extendedlocation/customlocations/<custom-___location-name>"
},
"___location": {
"value": "eastus"
},
"sshPublicKeys": {
"value": [
{
"keyData": "ssh-rsa AAAAA...."
},
{
"keyData": "ssh-rsa BBBBB...."
}
]
}
}
}
- テンプレートをデプロイします。
az deployment group create \
--resource-group myResourceGroup \
--template-file kubernetes-deploy.json \
--parameters @kubernetes-deploy-parameters.json
要求されたクラスター ノードをデプロイするのに十分な容量がない場合は、エラー メッセージが表示されます。 ただし、このメッセージでは、使用可能な容量に関する詳細は提供されません。 容量が不足しているため、クラスターの作成を続行できないことが示されています。
注
容量の計算では、個々のラックに限定されるのではなく、プラットフォーム クラスター全体が考慮されます。 そのため、容量が不十分なゾーン (ラックがゾーンと等しい) にエージェント プールが作成されていても、別のゾーンに十分な容量がある場合、クラスターの作成は続行されますが、最終的にはタイムアウトになります。容量をチェックするこの方法は、クラスターまたはエージェント プールの作成時に特定のゾーンが指定されていない場合にのみ有効です。
デプロイされているリソースを確認する
デプロイが完了したら、CLI または Azure portal を使用してリソースを表示できます。
myNexusK8sCluster
リソース グループ内の myResourceGroup
クラスターの詳細を表示するには、次の Azure CLI コマンドを実行します。
az networkcloud kubernetescluster show \
--name myNexusK8sCluster \
--resource-group myResourceGroup
さらに、myNexusK8sCluster
リソース グループ内の myResourceGroup
クラスターに関連付けられているエージェント プール名の一覧を取得するには、次の Azure CLI コマンドを使用できます。
az networkcloud kubernetescluster agentpool list \
--kubernetes-cluster-name myNexusK8sCluster \
--resource-group myResourceGroup \
--output table
クラスターに接続する
Nexus Kubernetes クラスターが正常に作成され、Azure Arc に接続されたので、クラスター接続機能を使用して簡単に接続できます。 クラスター接続を使用すると、どこからでもクラスターに安全にアクセスして管理できるため、対話型の開発、デバッグ、クラスター管理タスクに便利です。
使用可能なオプションの詳細については、「Azure Operator Nexus Kubernetes クラスターに接続する」を参照してください。
注
Nexus Kubernetes クラスターを作成すると、Nexus によってクラスター リソースの格納専用の管理対象リソース グループが自動的に作成され、このグループ内に Arc 接続クラスター リソースが確立されます。
クラスターにアクセスするには、クラスター接続 kubeconfig
を設定する必要があります。 関連する Microsoft Entra エンティティを使用して Azure CLI にログインした後、それを囲むファイアウォールの外側であっても、どこからでもクラスターと通信するために必要な kubeconfig
を取得できます。
CLUSTER_NAME
変数、RESOURCE_GROUP
変数、およびSUBSCRIPTION_ID
変数を設定します。CLUSTER_NAME="myNexusK8sCluster" RESOURCE_GROUP="myResourceGroup" SUBSCRIPTION_ID=<set the correct subscription_id>
az
を使用して管理対象リソース グループにクエリを実行し、MANAGED_RESOURCE_GROUP
に格納しますaz account set -s $SUBSCRIPTION_ID MANAGED_RESOURCE_GROUP=$(az networkcloud kubernetescluster show -n $CLUSTER_NAME -g $RESOURCE_GROUP --output tsv --query managedResourceGroupConfiguration.name)
次のコマンドは、指定された Nexus Kubernetes クラスターの Kubernetes API サーバーに接続できる connectedk8s プロキシを起動します。
az connectedk8s proxy -n $CLUSTER_NAME -g $MANAGED_RESOURCE_GROUP &
kubectl
を使用して、クラスターに要求を送信します。kubectl get pods -A
これで、すべてのノードの一覧が含まれているクラスターからの応答が表示されます。
注
"アクセス トークンをクライアント プロキシに投稿できませんでした。MSI に接続できませんでした" というエラー メッセージが表示された場合は、az login
を実行して Azure で再認証する必要がある場合があります。
エージェント プールを追加する
前の手順で作成したクラスターには、ノード プールが 1 つあります。 ARM テンプレートを使用して 2 つ目のエージェント プールを追加してみましょう。 次の例では、myNexusK8sCluster-nodepool-2
という名前のエージェント プールを作成します。
- テンプレートを確認します。
エージェント プール テンプレートを追加する前に、その構造を理解するためにコンテンツを確認しましょう。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"kubernetesClusterName": {
"type": "string",
"metadata": {
"description": "The name of Nexus Kubernetes cluster"
}
},
"___location": {
"type": "string",
"defaultValue": "[resourceGroup().___location]",
"metadata": {
"description": "The Azure region where the cluster is to be deployed"
}
},
"extendedLocation": {
"type": "string",
"metadata": {
"description": "The custom ___location of the Nexus instance"
}
},
"adminUsername": {
"type": "string",
"defaultValue": "azureuser",
"metadata": {
"description": "The username for the administrative account on the cluster"
}
},
"agentPoolSshKeys": {
"type": "array",
"metadata": {
"description": "The agent pool SSH public key that will be associated with the given user for secure remote login"
},
"defaultValue": []
/*
{
"keyData": "ssh-rsa AAAAA...."
},
{
"keyData": "ssh-rsa BBBBB...."
}
*/
},
"agentPoolNodeCount": {
"type": "int",
"defaultValue": 1,
"metadata": {
"description": "Number of nodes in the agent pool"
}
},
"agentPoolName": {
"type": "string",
"defaultValue": "nodepool-2",
"metadata": {
"description": "Agent pool name"
}
},
"agentVmSku": {
"type": "string",
"defaultValue": "NC_P10_56_v1",
"metadata": {
"description": "VM size of the agent nodes"
}
},
"agentPoolZones": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The zones/racks used for placement of the agent pool nodes"
}
/* array of strings Example: ["1", "2", "3"] */
},
"agentPoolMode": {
"type": "string",
"defaultValue": "User",
"metadata": {
"description": "Agent pool mode"
}
},
"agentOptions": {
"type": "object",
"defaultValue": {},
"metadata": {
"description": "The configurations for the initial agent pool"
}
/*
"hugepagesCount": int,
"hugepagesSize": "2M/1G"
*/
},
"labels": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The labels to assign to the nodes in the cluster for identification and organization"
}
/*
{
"key": "string",
"value": "string"
}
*/
},
"taints": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The taints to apply to the nodes in the cluster to restrict which pods can be scheduled on them"
}
/*
{
"key": "string",
"value": "string:NoSchedule|PreferNoSchedule|NoExecute"
}
*/
},
"l2Networks": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The Layer 2 networks to connect to the agent pool"
}
/*
{
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN|IPVLAN"
}
*/
},
"l3Networks": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The Layer 3 networks to connect to the agent pool"
}
/*
{
"ipamEnabled": "True/False",
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN|IPVLAN"
}
*/
},
"trunkedNetworks": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The trunked networks to connect to the agent pool"
}
/*
{
"networkId": "string",
"pluginType": "SRIOV|DPDK|OSDevice|MACVLAN|IPVLAN"
}
*/
}
},
"resources": [
{
"type": "Microsoft.NetworkCloud/kubernetesClusters/agentpools",
"apiVersion": "2025-02-01",
"name": "[concat(parameters('kubernetesClusterName'), '/', parameters('kubernetesClusterName'), '-', parameters('agentPoolName'))]",
"___location": "[parameters('___location')]",
"extendedLocation": {
"name": "[parameters('extendedLocation')]",
"type": "CustomLocation"
},
"properties": {
"administratorConfiguration": {
"adminUsername": "[parameters('adminUsername')]",
"sshPublicKeys": "[if(empty(parameters('agentPoolSshKeys')), json('null'), parameters('agentPoolSshKeys'))]"
},
"count": "[parameters('agentPoolNodeCount')]",
"mode": "[parameters('agentPoolMode')]",
"vmSkuName": "[parameters('agentVmSku')]",
"labels": "[if(empty(parameters('labels')), json('null'), parameters('labels'))]",
"taints": "[if(empty(parameters('taints')), json('null'), parameters('taints'))]",
"agentOptions": "[if(empty(parameters('agentOptions')), json('null'), parameters('agentOptions'))]",
"attachedNetworkConfiguration": {
"l2Networks": "[if(empty(parameters('l2Networks')), json('null'), parameters('l2Networks'))]",
"l3Networks": "[if(empty(parameters('l3Networks')), json('null'), parameters('l3Networks'))]",
"trunkedNetworks": "[if(empty(parameters('trunkedNetworks')), json('null'), parameters('trunkedNetworks'))]"
},
"availabilityZones": "[if(empty(parameters('agentPoolZones')), json('null'), parameters('agentPoolZones'))]",
"upgradeSettings": {
"maxSurge": "1"
}
},
"dependsOn": []
}
]
}
kubernetes-add-agentpool.json
という名前のテンプレート ファイルを確認して保存したら、次のセクションに進んでテンプレートをデプロイします。
-
kubernetes-nodepool-parameters.json
という名前のファイルを作成し、必要なパラメーターを JSON 形式で追加します。 開始点として、次の例を使用できます。 値は実際の値に置き換えてください。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"kubernetesClusterName":{
"value": "myNexusK8sCluster"
},
"extendedLocation": {
"value": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/microsoft.extendedlocation/customlocations/<custom-___location-name>"
}
}
}
- テンプレートをデプロイします。
az deployment group create \
--resource-group myResourceGroup \
--template-file kubernetes-add-agentpool.json \
--parameters @kubernetes-nodepool-parameters.json
注
初期エージェント プール構成を使用して、クラスター自体の初期作成時に複数のエージェント プールを追加できます。 ただし、初期作成後にエージェント プールを追加する場合は、上記のコマンドを使用して、Nexus Kubernetes クラスター用の追加のエージェント プールを作成できます。
エージェント プールが正常に作成された場合の出力の例は、次のようになります。
$ az networkcloud kubernetescluster agentpool list --kubernetes-cluster-name myNexusK8sCluster --resource-group myResourceGroup --output table
This command is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Count Location Mode Name ProvisioningState ResourceGroup VmSkuName
------- ---------- ------ ---------------------------- ------------------- --------------- -----------
1 eastus System myNexusK8sCluster-nodepool-1 Succeeded myResourceGroup NC_P10_56_v1
1 eastus User myNexusK8sCluster-nodepool-2 Succeeded myResourceGroup NC_P10_56_v1
リソースをクリーンアップする
不要になったら、リソース グループを削除します。 リソース グループとリソース グループ内のすべてのリソースが削除されます。
az group delete コマンドを使用すると、リソース グループおよび Kubernetes クラスターと、関連するすべてのリソース (Operator Nexus ネットワーク リソース以外) が削除されます。
az group delete --name myResourceGroup --yes --no-wait
次のステップ
直接、またはクラスター接続や Azure Operator Service Manager を介して、CNF をデプロイできるようになりました。