Photo by Guillaume Bolduc on Unsplash

Kubernetes Migration Using Velero — GKE to IKS

Vimal Prakash J
4 min readJul 16, 2020

--

Velero is an open source tool from Heptio, used for backup and restore operations of Kubernetes based cluster resources. It also enables to perform disaster recovery of production workloads, and also migrate to a new kubernetes cluster.

I started exploring this tool and its capabilities since the past week, and decided to take a weekend project where I try and explore a sample application migration from Google cloud’s GKE to IBM Cloud’s IKS. More information about Velero can be read here.

In this article, I will try and explain the high level steps performed and how Velero makes it easy and simple to migrate an application in kubernetes.

Note: For the sake of simplicity, I picked up an application without any PV (Persistent Volume).

High Level Steps :

  • Bring up a 2 node GKE cluster with OS selected as Ubuntu and remaining set to defaults. **Note: I had issues installing Velero when I opted for Container optimized OS, not sure why but I had to change it to Ubuntu for it to work.
  • I used the cloud shell to interact and you may choose to use Cloud CLI otherwise. Checking my current namespaces.
  • To install Velero, download the git repository from here and unzip the files to /usr/local/bin/velero.
> git clone https://github.com/heptio/velero
> curl -LO https://github.com/heptio/velero/releases/download/v1.1.0/velero-v1.1.0-linux-amd64.tar.gz
> tar -xzvf velero-v1.1.0-linux-amd64.tar.gz
> mv velero-v1.1.0-linux-amd64.tar.gz/velero /usr/local/bin/velero
  • For storing the backups, I used AWS’s S3 object storage service. Velero needs required permissions to access the S3 bucket, hence create a bucket and a new ID with required permissions. Capture the AccessID and SecretKey of the ID created to configure in Velero
  • Create a credentials file in below format with details captured from above step. Save it as “credentials-velero”
[default]
aws_access_key_id = [Place Your ID]
aws_secret_access_key = [Place Your KEY]
  • Install Velero using the AWS S3 bucket details. There are different set of instructions for various storage providers, so ensure to use the appropriate one for Azure Blob or Google Storage. Refer here for more details.
velero install \
--provider aws \
--bucket velerobackuptesting123 \
--backup-location-config region=us-east-1 \
--snapshot-location-config region=us-east-1 \
--secret-file ./credentials-velero
  • The installation completes quickly and you can then check the installed namespace and deployment.
  • Deploy a sample application for testing. I used the one available in Velero’s repo without a PV. Its here.
  • We are now ready to take a backup of the cluster. I used the full backup options with no exclusion values.
  • You may check the backup using “valero backup describe” or even check the storage to see if files are populated.
  • We are now done with taking backup from GKE which is stored in S3. Lets proceed to create a Kubernetes cluster in IKS, install Velero following the same steps. ***Note: I used a single node IKS cluster due to free tier limitations
  • Velero is now ready to restore the cluster resources from GKE to IKS. Use the Velero restore command
  • Restore should complete successfully and you can now go ahead to check the cluster resources that are deployed in IKS similar to GKE.

This completes the successful migration of a Kubernetes cluster resources from GKE to IKS. The process is simplified due to non usage of PV, and that’s for a new day.

I hope this article shows a high level view of the steps required although this is not elaborate or error free. I had my own share of issues and had to troubleshoot them to complete it.

Glad to have spend few hours on this learning and here it is for anybody to enjoy !!!

Reference Links:

https://github.com/vmware-tanzu/velero-plugin-for-aws

https://www.katacoda.com/petermbenjamin/scenarios/heptio-velero

--

--

Vimal Prakash J

DevOps, Cloud, Learning Projects, Technology and everything that is worth sharing. || linkedin.com/in/vmalj