An Interest In:
Web News this Week
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
Node pool snapshot in AKS
AKS releases a new node image weekly
and every new cluster, new node pool, or upgrade cluster will always receive the latest image that can make it hard to maintain our environments consistent
and to have repeatable environments.
Node pool snapshots allow us to take a configuration snapshot
of our node pool and then create new node pools or new clusters based of that snapshot for as long as that configuration and kubernetes version is supported. For more information on the supportability windows, see Supported Kubernetes versions in AKS.
The snapshot is an Azure resource that will contain the configuration information from the source node pool such as the node image version
, kubernetes version
, OS type
, and OS SKU
. We can then reference this snapshot resource and the respective values of its configuration to create any new node pool or cluster based off of it.
Prerequisites
Assuming that we have an existing AKS cluster. If we need an AKS cluster, see the AKS quickstart using the Azure CLI, using Azure PowerShell, or using the Azure portal.
Limitations
- Any node pool or cluster created from a snapshot must use a
VM from the same virtual machine family
as the snapshot, for example, we can't create a new N-Series node pool based of a snapshot captured from a D-Series node pool because the node images in those cases arestructurally different
. - Snapshots must be created and
used in the same region as the source node pool
.
Take a node pool snapshot
In order to take a snapshot from a node pool first we'll need the node pool resource ID
, which we can get from the command below:
NODEPOOL_ID=$(az aks nodepool show --name nodepool1 --cluster-name kcdCluster --resource-group kcdrg --query id -o tsv)
Now, to take a snapshot from the previous node pool we'll use the az aks snapshot
CLI command.
az aks snapshot create --name kcdSnapshot --resource-group kcdrg --nodepool-id $NODEPOOL_ID --location eastus
Create a node pool from a snapshot
First we'll need the resource ID from the snapshot that was previously created, which we can get from the command below:
SNAPSHOT_ID=$(az aks snapshot show --name kcdSnapshot --resource-group kcdrg --query id -o tsv)
Now, we can use the command below to add a new node pool based off of this snapshot.
az aks nodepool add --name np2 --cluster-name kcdCluster --resource-group kcdrg --snapshot-id $SNAPSHOT_ID
Upgrading a node pool to a snapshot
We can upgrade a node pool to a snapshot configuration so long as the snapshot kubernetes version and node image version are more recent than the versions in the current node pool.
First we'll need the resource ID from the snapshot that was previously created, which we can get from the command below:
SNAPSHOT_ID=$(az aks snapshot show --name kcdSnapshot --resource-group kcdrg --query id -o tsv)
Now, we can use this command to upgrade this node pool to this snapshot configuration.
az aks nodepool upgrade --name nodepool1 --cluster-name kcdCluster --resource-group kcdrg --snapshot-id $SNAPSHOT_ID
Create a cluster from a snapshot
When we create a cluster from a snapshot, the cluster original system pool will be created from the snapshot configuration.
First we'll need the resource ID from the snapshot that was previously created, which we can get from the command below:
SNAPSHOT_ID=$(az aks snapshot show --name kcdSnapshot --resource-group kcdrg --query id -o tsv)
Now, we can use this command to create this cluster off of the snapshot configuration.
az aks create --name kcdCluster2 --resource-group kcdrg --snapshot-id $SNAPSHOT_ID
Thanks for reading my article till end. I hope you learned something special today. If you enjoyed this article then please share to your friends and if you have suggestions or thoughts to share with me then please write in the comment box.
Original Link: https://dev.to/kcdchennai/node-pool-snapshot-in-aks-4jb6
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To