Backup and upgrade your EKS cluster from version 1.17 to 1.18 with Velero and eksctl.

For compatibility and product maturity reasons, I usually tend to upgrade my EKS clusters to a lower version than the one currently released.
AWS introduced 1.19 support for EKS, so it’s time to upgrade my cluster to 1.18.
Before proceeding with the update it is always good to read the changes that the new version will make and make a backup. I will never tire of emphasizing the importance of a backup in case something goes wrong.

Tools used:

an EKS cluster (it seems obvious to me) :-)
kubectl
AWS cli
eksctl (version 0.38.0 or above)
Velero
KubePug — Pre UpGrade (optional)

Velero

Velero is an open source tool to safely backup and restore, perform disaster recovery, and migrate Kubernetes cluster resources and persistent volumes. With Velero you can backup the entire cluster or single namespace (s) or filter objects by using labels. Can be used to migrate your on-prem Kubernetes workloads to cloud and cluster upgrades too.

Velero uses AWS S3 bucket to backup EKS clusters, so the first thing to do will be to create the bucket that will contain our backup. For this purpose we can use the console or the AWS cli with the command:

now let’s create an IAM user for Velero:

create a file called velero-policy.json and paste the following policy in order to give the IAM user previously created the necessary policies:

attach policy to velero IAM user using the command:

create and export the user’s access key:

let’s create a file called velero-credentials and paste in the access key and secret key created previously:

Install velero downloading the latest version available from the repository:

extract the content and move the velero file to /usr/local/bin

verify that it is correctly installed:

in my case the command also returns the version installed on the cluster as it was previously installed.
Let’s proceed with the installation of velero on EKS:

check that the installation was successful:

Optional step

Check the deprecated API and any breaking changes using KubePug — Pre UpGrade.

Download and install the latest version available:

verify the correct installation:

Let’s check the cluster status for deprecated API using the EKS Kubernetes released version (1.18.9 in this case):

Once we have verified the compatibility of our deployments with our API, we can continue.

Let’s backup

Let’s proceed to make the backup:

We will see that a folder called “backups” will be created in the bucket containing the data of the various backups, in our case a folder called staging-backup

The snapshots of the PVCs present will also be done automatically:

Run a backup describe and logs to see if you get any error or failed status on your backup:

Once we have backed up everything, we can proceed with the cluster upgrade. This procedure requires eksctl version 0.38.0 or later. You can check your version with the following command:

If you don’t have eksctl already installed, you can install it with the following command:

If eksctl is already installed, run the following command to upgrade:

Let’s do the cluster upgrade:

After verifying all the changes that will be made we can launch:

let’s wait the end of the upgrade and proceed to upgrade the nodegroups:

Once the upgrade of the nodegroups has been completed, let’s update the default add-ons:

also in this case we will have to use

at the end of the command to execute it

Once this operation is completed, our cluster will have been upgraded to version 1.18 and the nodegroups to the latest AMI release version available.
After having done all the necessary checks it will be possible to delete the bucket and the snapshots created during the backup (although personally I recommend keeping them at least for a week to be more secure).

AWS Solutions Architect certified | AWS Community Builder | IT lover and addicted

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store