Tutorial / Cram Notes
Azure Kubernetes Service (AKS) is a managed container orchestration service, which simplifies Kubernetes management, deployment, and operations. As an Azure administrator preparing for the AZ-104 exam, understanding how to upgrade an AKS cluster is crucial. Upgrading an AKS cluster ensures that you have the latest features, security updates, and performance improvements.
Prerequisites for Upgrading an AKS Cluster:
Before performing an upgrade, you should:
- Review upgrade notifications: Azure will inform you when a new Kubernetes version is available for your AKS clusters.
- Check for current and available versions: Use the az aks get-versions command to check the available Kubernetes versions in your region.
- Test the upgrade in a non-production environment: Always try the upgrade in a testing environment before applying it to your production cluster.
Performing the Upgrade:
Step 1: Verify Your AKS Cluster’s Current Version
az aks show --resource-group myResourceGroup --name myAKSCluster --output table
Step 2: Check for Available Upgrades
az aks get-upgrades --resource-group myResourceGroup --name myAKSCluster --output table
Step 3: Upgrade the AKS Cluster
az aks upgrade --resource-group myResourceGroup --name myAKSCluster --kubernetes-version
Here is an example of upgrading an AKS cluster to Kubernetes version 1.20.6:
az aks upgrade --resource-group myResourceGroup --name myAKSCluster --kubernetes-version 1.20.6
Step 4: Validate the Upgrade
az aks show --resource-group myResourceGroup --name myAKSCluster --output table
Monitoring the Upgrade Process:
While the upgrade is taking place, AKS performs a cordon and drain process on the nodes, ensuring that the workloads are safely moved to other nodes before upgrading the underlying VM. You can monitor the status of the nodes by using the following command:
kubectl get nodes -o wide
Best Practices for Upgrade:
- Stagger the upgrades: Avoid upgrading all clusters at once, especially in production environments. Plan a rollout upgrade strategy.
- Backup your data: Ensure that your cluster data, such as Persistent Volume data, is backed up before performing an upgrade.
- Review the release notes: Familiarize yourself with breaking changes and new features in the release notes.
Handling Node Pool Upgrades:
AKS allows you to also manage and upgrade the node pools separately. Here are the commands to upgrade node pools:
List the available node pools:
az aks nodepool list --resource-group myResourceGroup --cluster-name myAKSCluster --output table
Upgrade a specific node pool:
az aks nodepool upgrade --resource-group myResourceGroup --cluster-name myAKSCluster --name myNodePool --kubernetes-version
Post-upgrade Considerations:
- Validate workloads: After upgrading, review that all workloads are up and running.
- Review deprecated APIs: If you have skipped versions, check for any deprecated APIs and update your manifests accordingly.
- Update tooling: Ensure your CI/CD and local development tooling are compatible with the new cluster version.
AKS makes cluster management and upgrades a streamlined process compared to manual Kubernetes upgrades. It is essential for administrators to stay informed about the upgrade strategies and leverage Azure’s native tools to maintain their clusters effectively. Following the upgrade guidelines will help to ensure that your AKS clusters remain secure, performant, and feature-rich.
Practice Test with Explanation
True or False: AKS clusters can be upgraded manually or automatically.
- A) True
- B) False
Answer: A) True
Explanation: AKS clusters can be manually upgraded using the Azure CLI or portal, or set to automatically upgrade when a new Kubernetes version is available.
When upgrading an AKS cluster, all nodes are upgraded simultaneously.
- A) True
- B) False
Answer: B) False
Explanation: During an AKS cluster upgrade, nodes are upgraded one at a time to ensure that the workloads remain available.
True or False: Before upgrading an AKS cluster, you should review the release notes for the Kubernetes version you are upgrading to.
- A) True
- B) False
Answer: A) True
Explanation: Reviewing the release notes for the target Kubernetes version is essential as it helps you understand the changes, new features, deprecations, or any important upgrade notes.
What is the command to upgrade an AKS cluster using Azure CLI?
- A) az aks upgrade
- B) az aks update
- C) az aks set-version
- D) az aks kubernetes-upgrade
Answer: A) az aks upgrade
Explanation: The ‘az aks upgrade’ command is used to upgrade the Kubernetes version of an AKS cluster.
Which AKS component cannot be upgraded once the AKS cluster is created?
- A) Kubernetes version
- B) Node size
- C) Service Principal
- D) Network plugin
Answer: D) Network plugin
Explanation: The network plugin (Azure CNI or kubenet) cannot be changed after an AKS cluster is created. You must choose the appropriate network plugin at the time of cluster creation.
In a multi-node AKS cluster, can you still serve applications while performing a cluster upgrade?
- A) Yes, but with potential interruptions
- B) Yes, without interruptions
- C) No, the cluster will be unavailable
- D) It depends on the Kubernetes version
Answer: B) Yes, without interruptions
Explanation: If performed correctly, a rolling update in a multi-node cluster allows applications to remain available as nodes are upgraded one at a time.
True or False: Azure automatically takes a snapshot of your AKS cluster’s node before upgrading.
- A) True
- B) False
Answer: B) False
Explanation: Azure does not automatically take a snapshot of AKS nodes before an upgrade. Users are responsible for any necessary backup before performing the upgrade.
When using Azure Portal, where can you find the option to upgrade your AKS cluster?
- A) Under the “Properties” section
- B) Under the “Support + troubleshooting” section
- C) Under the “Settings” section, then “Upgrade”
- D) Under the “Monitoring” section
Answer: C) Under the “Settings” section, then “Upgrade”
Explanation: In the Azure Portal, the option to upgrade the AKS cluster is found under the “Settings” section by clicking on “Upgrade”.
After an AKS cluster upgrade, is it necessary to manually update the kubelet on each node?
- A) Yes, it is a necessary manual step
- B) No, kubelet is updated automatically during the upgrade process
Answer: B) No, kubelet is updated automatically during the upgrade process
Explanation: The kubelet and other Kubernetes components on the nodes are automatically updated as part of the AKS cluster upgrade process.
True or False: It is possible to skip Kubernetes minor versions during an AKS cluster upgrade.
- A) True
- B) False
Answer: B) False
Explanation: AKS does not support skipping minor versions during an upgrade. You must upgrade to each minor version sequentially.
In AKS, what is the purpose of a node image upgrade?
- A) To update the Kubernetes version
- B) To update the underlying operating system and runtime components of the agent nodes
- C) To change the node VM size
- D) To configure node auto-repair settings
Answer: B) To update the underlying operating system and runtime components of the agent nodes
Explanation: A node image upgrade updates the OS image and runtime components of the AKS nodes but does not change the Kubernetes version.
Does Azure provide an SLA guarantee during the AKS cluster upgrade process?
- A) Yes, the upgrade process is covered by an SLA
- B) No, the upgrade process does not have an SLA from Azure
Answer: B) No, the upgrade process does not have an SLA from Azure
Explanation: Microsoft does not provide an SLA for the AKS cluster upgrade process. It is recommended to plan and test upgrades carefully to minimize disruptions.
Interview Questions
What is AKS, and why is it important to upgrade an AKS cluster?
AKS is a fully managed Kubernetes service provided by Microsoft Azure that enables you to deploy and manage containerized applications. It is important to upgrade an AKS cluster to keep it up to date with the latest features, bug fixes, and security updates.
What are the two main approaches to upgrading an AKS cluster?
The two main approaches to upgrading an AKS cluster are control plane upgrades and node upgrades.
What is a control plane upgrade, and how is it managed in AKS?
A control plane upgrade involves upgrading the Kubernetes version of the AKS cluster’s API server, controller manager, and etcd. Control plane upgrades are managed by Azure, which means that you don’t need to manually upgrade the control plane.
What is a node upgrade, and how is it managed in AKS?
A node upgrade involves upgrading the Kubernetes version of the worker nodes in the AKS cluster. Node upgrades are not managed by Azure, which means that you need to manually upgrade the nodes.
How can you check if a new control plane version is available for your AKS cluster?
You can check if a new control plane version is available for your AKS cluster by running the “az aks get-upgrades” command.
How can you upgrade the control plane of an AKS cluster?
You can upgrade the control plane of an AKS cluster by running the “az aks upgrade” command.
How can you check if a new node version is available for your AKS cluster?
You can check if a new node version is available for your AKS cluster by running the “az aks get-upgrades” command.
What are the two approaches to upgrading the nodes in an AKS cluster?
The two approaches to upgrading the nodes in an AKS cluster are manually upgrading each node and using the AKS Upgrade Wizard.
What is the AKS Upgrade Wizard, and how does it work?
The AKS Upgrade Wizard is a tool that automates the process of upgrading the nodes in an AKS cluster. It allows you to upgrade multiple nodes simultaneously.
How can you manually upgrade each node in an AKS cluster?
You can manually upgrade each node in an AKS cluster by creating a new node pool with the updated Kubernetes version and migrating workloads to the new node pool.
Really helpful post on upgrading an AKS cluster for AZ-104 exam prep. Thanks!
What’s the first step in upgrading an AKS cluster?
Is there any downtime expected during the upgrade?
Does upgrading AKS require reconfiguration of the clusters?
What happens if the upgrade fails midway?
Can we automate the upgrade process using Azure DevOps?
Appreciate the detailed guide, it was really clear and concise!
I had issues with the upgrade script not recognizing the Resource Group. Any tips?