Skip to content

Commit 257a28e

Browse files
authored
Merge pull request #202953 from phealy/pahealy/api-server-vnet-integration
AKS API Server VNet Integration
2 parents 19a2598 + 3ac1bea commit 257a28e

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
lines changed

articles/aks/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@
329329
href: configure-kubenet-dual-stack.md
330330
- name: Use Azure-CNI
331331
href: configure-azure-cni.md
332+
- name: Use API Server VNet Integration
333+
href: api-server-vnet-integration.md
332334
- name: Bring your own CNI
333335
href: use-byo-cni.md
334336
- name: Create an internal load balancer
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
---
2+
title: API Server VNet Integration in Azure Kubernetes Service (AKS)
3+
description: Learn how to create an Azure Kubernetes Service (AKS) cluster with API Server VNet Integration
4+
services: container-service
5+
ms.topic: article
6+
ms.date: 06/27/2022
7+
ms.custom: references_regions
8+
9+
---
10+
11+
# Create an Azure Kubernetes Service cluster with API Server VNet Integration (PREVIEW)
12+
13+
An Azure Kubernetes Service (AKS) cluster with API Server VNet Integration configured projects the API server endpoint directly into a delegated subnet in the VNet where AKS is deployed. This enables network communication between the API server and the cluster nodes without any required private link or tunnel. The API server will be available behind an Internal Load Balancer VIP in the delegated subnet, which the nodes will be configured to utilize. By using API Server VNet Integration, you can ensure network traffic between your API server and your node pools remains on the private network only.
14+
15+
16+
17+
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
18+
19+
## API server connectivity
20+
21+
The control plane or API server is in an Azure Kubernetes Service (AKS)-managed Azure subscription. A customer's cluster or node pool is in the customer's subscription. The server and the virtual machines that make up the cluster nodes can communicate with each other through the API server VIP and pod IPs that are projected into the delegated subnet.
22+
23+
At this time, API Server VNet integration is only supported for private clusters. Unlike standard public clusters, the agent nodes communicate directly with the private IP address of the ILB VIP for communication to the API server without using DNS. External clients needing to communicate with the cluster should follow the same private DNS setup methodology as standard [private clusters](private-clusters.md).
24+
25+
## Region availability
26+
27+
API Server VNet Integration is available in the following regions at this time:
28+
29+
- canary regions
30+
- eastus2
31+
- northcentralus
32+
- westcentralus
33+
- westus2
34+
35+
## Prerequisites
36+
37+
* Azure CLI with aks-preview extension 0.5.67 or later.
38+
* If using ARM or the REST API, the AKS API version must be 2022-04-02-preview or later.
39+
40+
### Install the aks-preview CLI extension
41+
42+
```azurecli-interactive
43+
# Install the aks-preview extension
44+
az extension add --name aks-preview
45+
46+
# Update the extension to make sure you have the latest version installed
47+
az extension update --name aks-preview
48+
```
49+
50+
### Register the `EnableAPIServerVnetIntegrationPreview` preview feature
51+
52+
To create an AKS cluster with API Server VNet Integration, you must enable the `EnableAPIServerVnetIntegrationPreview` feature flag on your subscription.
53+
54+
Register the `EnableAPIServerVnetIntegrationPreview` feature flag by using the `az feature register` command, as shown in the following example:
55+
56+
```azurecli-interactive
57+
az feature register --namespace "Microsoft.ContainerService" --name "EnableAPIServerVnetIntegrationPreview"
58+
```
59+
60+
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the `az feature list` command:
61+
62+
```azurecli-interactive
63+
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/EnableAPIServerVnetIntegrationPreview')].{Name:name,State:properties.state}"
64+
```
65+
66+
When the feature has been registered, refresh the registration of the *Microsoft.ContainerService* resource provider by using the `az provider register` command:
67+
68+
```azurecli-interactive
69+
az provider register --namespace Microsoft.ContainerService
70+
```
71+
72+
## Create an AKS cluster with API Server VNet Integration using Managed VNet
73+
74+
AKS clusters with API Server VNet Integration can be configured in either managed VNet or bring-your-own VNet mode.
75+
76+
### Create a resource group
77+
78+
Create a resource group or use an existing resource group for your AKS cluster.
79+
80+
```azurecli-interactive
81+
az group create -l westus2 -n <resource-group>
82+
```
83+
84+
### Deploy the cluster
85+
86+
```azurecli-interactive
87+
az aks create -n <cluster-name> \
88+
-g <resource-group> \
89+
-l <location> \
90+
--network-plugin azure \
91+
--enable-private-cluster \
92+
--enable-apiserver-vnet-integration
93+
```
94+
95+
Where `--enable-private-cluster` is a mandatory flag for a private cluster, and `--enable-apiserver-vnet-integration` configures API Server VNet integration for Managed VNet mode.
96+
97+
## Create an AKS cluster with API Server VNet Integration using bring-your-own VNet
98+
99+
When using bring-your-own VNet, an API server subnet must be created and delegated to `Microsoft.ContainerService/managedClusters`. This grants the AKS service permissions to inject the API server pods and internal load balancer into that subnet. The subnet may not be used for any other workloads, but may be used for multiple AKS clusters located in the same virtual network. An AKS cluster will require from 2-7 IP addresses depending on cluster scale. The minimum supported API server subnet size is a /28.
100+
101+
Note that the cluster identity needs permissions to both the API server subnet and the node subnet. Lack of permissions at the API server subnet will cause a provisioning failure.
102+
103+
> [!WARNING]
104+
> Running out of IP addresses may prevent API server scaling and cause an API server outage.
105+
106+
### Create a resource group
107+
108+
Create a resource group or use an existing resource group for your AKS cluster.
109+
110+
```azurecli-interactive
111+
az group create -l <location> -n <resource-group>
112+
```
113+
114+
### Create a virtual network
115+
116+
```azurecli-interactive
117+
# Create the virtual network
118+
az network vnet create -n <vnet-name> \
119+
-l <location> \
120+
--address-prefixes 172.19.0.0/16
121+
122+
# Create an API server subnet
123+
az network vnet subnet create --vnet-name <vnet-name> \
124+
--name <apiserver-subnet-name> \
125+
--delegations Microsoft.ContainerService/managedClusters \
126+
--address-prefixes 172.19.0.0/28
127+
128+
# Create a cluster subnet
129+
az network vnet subnet create --vnet-name <vnet-name> \
130+
--name <cluster-subnet-name> \
131+
--address-prefixes 172.19.1.0/24
132+
```
133+
134+
### Create a managed identity and give it permissions on the virtual network
135+
136+
```azurecli-interactive
137+
# Create the identity
138+
az identity create -n <managed-identity-name> -l <location>
139+
140+
# Assign Network Contributor to the API server subnet
141+
az role assignment create --scope <apiserver-subnet-resource-id> \
142+
--role "Network Contributor" \
143+
--assignee <managed-identity-client-id>
144+
145+
# Assign Network Contributor to the cluster subnet
146+
az role assignment create --scope <cluster-subnet-resource-id> \
147+
--role "Network Contributor" \
148+
--assignee <managed-identity-client-id>
149+
```
150+
151+
### Create the AKS cluster
152+
153+
```azurecli-interactive
154+
az aks create -n <cluster-name> \
155+
-g <resource-group> \
156+
-l <location> \
157+
--network-plugin azure \
158+
--enable-private-cluster \
159+
--enable-apiserver-vnet-integration \
160+
--vnet-subnet-id <cluster-subnet-resource-id> \
161+
--apiserver-subnet-id <apiserver-subnet-resource-id> \
162+
--assign-identity <managed-identity-resource-id>
163+
```
164+
165+
## Limitations
166+
* Existing AKS clusters cannot be converted to API Server VNet Integration clusters at this time.
167+
* Only [private clusters](private-clusters.md) are supported at this time.
168+
* [Private Link Service][private-link-service] will not work if deployed against the API Server injected addresses at this time, so the API server cannot be exposed to other virtual networks via private link. To access the API server from outside the cluster network, utilize either [VNet peering][virtual-network-peering] or [AKS run command][command-invoke].
169+
170+
<!-- LINKS - internal -->
171+
[az-provider-register]: /cli/azure/provider#az_provider_register
172+
[az-feature-register]: /cli/azure/feature#az_feature_register
173+
[az-feature-list]: /cli/azure/feature#az_feature_list
174+
[az-extension-add]: /cli/azure/extension#az_extension_add
175+
[az-extension-update]: /cli/azure/extension#az_extension_update
176+
[private-link-service]: ../private-link/private-link-service-overview.md#limitations
177+
[private-endpoint-service]: ../private-link/private-endpoint-overview.md
178+
[virtual-network-peering]: ../virtual-network/virtual-network-peering-overview.md
179+
[azure-bastion]: ../bastion/tutorial-create-host-portal.md
180+
[express-route-or-vpn]: ../expressroute/expressroute-about-virtual-network-gateways.md
181+
[devops-agents]: /azure/devops/pipelines/agents/agents
182+
[availability-zones]: availability-zones.md
183+
[command-invoke]: command-invoke.md
184+
[container-registry-private-link]: ../container-registry/container-registry-private-link.md
185+
[virtual-networks-name-resolution]: ../virtual-network/virtual-networks-name-resolution-for-vms-and-role-instances.md#name-resolution-that-uses-your-own-dns-server

0 commit comments

Comments
 (0)