Plan for a K8s Migration
Few days ago I got a task on migration. We were running few monitoring applications on Virtual Machines. Due to some constraints ( I will explain below) we wanted to migrate applications to the Kubernetes. This might help you tp migrate your apps from VM to K8s in furture.
Why K8s Migration:
- Scaling Virtual Machines — Scaling virtual machines is not a critical task ( if you integrate with Terraform). But scaling in might be a risky task if you’re dealing with volume mounts. Copying data /Backup /Retain to another VM’s volume might be challenging upon the application setup.
- Upgrade OS/Kernel (and or dependency packages) — This is also little bit risk unless you have test/dev environment prior to exact same production environment.
- Resource Utilisation — Not a challenge, but more controllable when it comes to containerisation.
Okay let’s go back to our topic.
So you should have proper plan to kick off this project, lets break into small pieces in order to achieve this goal.
Steps
- Gather Requirements- If this is going to setup on base on customer request, you should check all the versions and infrastructure requirements for the Kubernetes setup.
- Capacity Planning — How any VMs running with CPU and Mem + additional volume storage capacities. This is necessary to build or request for a Kubernetes cluster. We could able to identify what type of resources we need.
- Identify URLs, DNS, Ports- This is necessary for you application to be reached from internet. You might need to do some additional work apart of application deployment, but it is onetime task. So pay attention to this as well.
- Secrets — If you want to deal with any sort of credentials (password, tokens, access keys) you should use Kubernetes secrets.
- Deployment — Most recommended way is to deploy application with Helm templates. Hence check latest version of helm templates for your deployment. If there are any custom changes needed according to your setup, make sure to use custom ConfigMaps to make it available in the chart.
- Dependency Apps — This might not valid for all scenarios, but most of time our applications are connected with some other applications (Eg: Grafana Loki with Grafana, Prometheus with Grafana). Hence check the connectivity to the dependancy apps, if need any amendments, this is the phase you should work on it.
- Testing- This is mandatory if this has not been tested for any lower environments before. If possible try with dummy data (synthetic data) before enabling for production data / real data.
- Monitoring — As DevOps/SRE, we always care about system performance, health and availability. So lets enable monitoring for the K8s setup prior to enable production data flow.
- Stakeholders — If you’re following change management/release management, you might need to update channels/stakeholder regarding this change timeline (if you need any downtime or period of unavailability of the system). Also you might need to disable alarms for old system and enable for new system during this period, also this shouldn’t be your peak hours.
- Enable data flow — Enable routing or switching of logs to K8s workflow.
- Post Checks — Monitor using dashboards if easiest way to track how healthy is your new system.
- Confirmation — You can update channels regarding the new system health and new URLs or the new process with the confirmation.
- Decomission old system — This is something take care after successful confirmation of the new system.
I have tried to collect almost necessary steps to carried over the migration process according to the ITIL standards. Let me know if I missed any.
Thanks for reading.