Intended audience

sysadm staff members

Azure Kubernetes Service howtos#

Kubernetes clusters#

 az aks list | jq -r '.[]|
"\(.name) \(.kubernetesVersion) \(.location) \(.resourceGroup)"' | \
awk 'BEGIN{format="%-25s %-20s %-15s %-15s\n";
printf format,"Cluster Name", "Kubernetes Version", "Location", "Resource Group";
printf format,"---","---","---","---"}
{printf format,$1,$2,$3,$4}'
Cluster Name              Kubernetes Version   Location        Resource Group
---                       ---                  ---             ---
euwest-gitlab-staging     1.29.4               westeurope      euwest-gitlab-staging
euwest-rancher            1.28.9               westeurope      euwest-rancher
euwest-gitlab-production  1.29.4               westeurope      euwest-gitlab-production

Upgrading Kubernetes#

The Kubernetes supported version in AKS can be checked on this release calendar.
For the Rancher cluster, check the supported versions.
For the GitLab clusters, check which versions are supported by the operator.

Get the current GitLab operator version

 for app in $(kubectl --context cluster-admin-rke2 get applications -n argocd -o name | \
awk '/gitlab-operator/');do
awk '{split($1,a,"/");print a[2]}' <<< "$app"
kubectl --context cluster-admin-rke2 describe "$app" -n argocd | \
awk '/registry.gitlab.com/{split($1,a,":");printf "\t version: %s\n", a[2]}'
done
gitlab-production-gitlab-operator
   version: 1.1.1
gitlab-staging-gitlab-operator
   version: 1.1.1

Get the current Rancher version

 for pod in $(kubectl --context local get pods -n cattle-system -l app=rancher -o name)
do kubectl --context local describe -n cattle-system "$pod" | \
awk '/^([[:space:]]*Image|Name):/'
done
Name:                 rancher-58994f549-5phdn
    Image:         rancher/rancher:v2.8.4
Name:                 rancher-58994f549-dq86k
    Image:         rancher/rancher:v2.8.4

Check the current node pool image.

 az aks nodepool show \
    --resource-group euwest-gitlab-staging \
    --cluster-name euwest-gitlab-staging \
    --name default \
    --query nodeImageVersion
"AKSUbuntu-2204gen2containerd-202312.06.0"

Check the current kubernetes version and the future node pool image.

 az aks nodepool get-upgrades --resource-group euwest-gitlab-staging \
    --nodepool-name default \
    --cluster-name euwest-gitlab-staging --output table
KubernetesVersion    LatestNodeImageVersion                    Name     OsType    ResourceGroup
-------------------  ----------------------------------------  -------  --------  ---------------------
1.26.10              AKSUbuntu-2204gen2containerd-202406.07.0  default  Linux     euwest-gitlab-staging

Node Pool Image

The node image is automatically updated when upgrading the node pool to a new Kubernetes version, but the node pool can be manually updated to the latest image outside of a Kubernetes version upgrade.

Get the available upgrades in the next minor version.

 az aks get-upgrades --resource-group euwest-gitlab-staging \
    --name euwest-gitlab-staging --output table
Name     ResourceGroup          MasterVersion    Upgrades
-------  ---------------------  ---------------  ---------------
default  euwest-gitlab-staging  1.26.10          1.27.9, 1.27.13

Launch the upgrade.

 az aks upgrade  \
    --resource-group euwest-gitlab-staging \
    --name euwest-gitlab-staging \
    --kubernetes-version 1.27.13

Repeat the same operations for each minor version.

GitLab Terraform Code

Once you are done with the cluster upgrade, update the kubernetes_version variable in the azure/terraform/gitlab.tf file in the sysadm-provisioning repository.