Skip to content

Commit 55fd2ce

Browse files
zioprotolonegunmanb
authored andcommitted
Extend multiple_node_pools example to test AKS upgrades
1 parent 698d5e7 commit 55fd2ce

File tree

3 files changed

+94
-8
lines changed

3 files changed

+94
-8
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Testing the upgrade scenario
2+
3+
You can use this example to manually test the upgrade scenario.
4+
5+
See existing AKS versions:
6+
7+
```
8+
% az aks get-versions --location centralus
9+
KubernetesVersion Upgrades
10+
------------------- ------------------------
11+
1.28.3 None available
12+
1.28.0 1.28.3
13+
1.27.7 1.28.0, 1.28.3
14+
1.27.3 1.27.7, 1.28.0, 1.28.3
15+
1.26.10 1.27.3, 1.27.7
16+
1.26.6 1.26.10, 1.27.3, 1.27.7
17+
1.25.15 1.26.6, 1.26.10
18+
1.25.11 1.25.15, 1.26.6, 1.26.10
19+
```
20+
21+
In this example we test an upgrade from 1.26.10 to 1.27.7.
22+
23+
## Create the AKS cluster at version 1.26.10:
24+
25+
```
26+
terraform init -upgrade
27+
terraform apply -var="kubernetes_version=1.26.10" -var="orchestrator_version=1.26.10"
28+
```
29+
30+
Verify the AKS cluster version:
31+
32+
```
33+
az aks list -o table # check AKS version
34+
az aks get-credentials --resource-group <rg> --name <name>
35+
kubectl version # check api server version
36+
kubectl get nodes # check nodes version
37+
```
38+
39+
In the `az aks list` output you will have `KubernetesVersion` and `CurrentKubernetesVersion` both at 1.26.10
40+
41+
## Upgrade the AKS cluster control plane only to version 1.27.7
42+
43+
```
44+
terraform apply -var="kubernetes_version=1.27.7" -var="orchestrator_version=1.26.10"
45+
```
46+
47+
Check the new versions:
48+
49+
50+
```
51+
az aks list -o table # check AKS version
52+
kubectl version # check api server version
53+
kubectl get nodes # check nodes version
54+
```
55+
56+
In the `az aks list` output you will have `KubernetesVersion` and `CurrentKubernetesVersion` both at 1.27.7
57+
The control plane version will be 1.27.7 and the nodes will be 1.26.10.
58+
59+
## Upgrade the AKS cluster node pools to version 1.27.7
60+
61+
```
62+
terraform apply -var="kubernetes_version=1.27.7" -var="orchestrator_version=1.27.7"
63+
```
64+
65+
Check the new versions:
66+
67+
```
68+
az aks list -o table # check AKS version
69+
kubectl version # check api server version
70+
kubectl get nodes # check nodes version
71+
```
72+
73+
In the `az aks list` output you will have `KubernetesVersion` and `CurrentKubernetesVersion` both at 1.27.7
74+
The control plane version will be 1.27.7 and the nodes will be 1.27.7.

examples/multiple_node_pools/main.tf

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ locals {
4545
module "aks" {
4646
source = "../.."
4747

48-
prefix = "prefix-${random_id.prefix.hex}"
49-
resource_group_name = local.resource_group.name
50-
location = local.resource_group.location
51-
os_disk_size_gb = 60
52-
sku_tier = "Standard"
53-
rbac_aad = false
54-
vnet_subnet_id = azurerm_subnet.test.id
55-
node_pools = local.nodes
48+
prefix = "prefix-${random_id.prefix.hex}"
49+
resource_group_name = local.resource_group.name
50+
location = local.resource_group.location
51+
os_disk_size_gb = 60
52+
sku_tier = "Standard"
53+
rbac_aad = false
54+
vnet_subnet_id = azurerm_subnet.test.id
55+
node_pools = local.nodes
56+
kubernetes_version = var.kubernetes_version
57+
orchestrator_version = var.orchestrator_version
5658
}

examples/multiple_node_pools/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ variable "resource_group_name" {
1212
type = string
1313
default = null
1414
}
15+
16+
variable "kubernetes_version" {
17+
type = string
18+
default = null
19+
}
20+
21+
variable "orchestrator_version" {
22+
type = string
23+
default = null
24+
}

0 commit comments

Comments
 (0)