fbpx

The following tutorial covers the steps required to migrate existing K8s workloads into an Ocean cluster.

After you’ve created an Ocean cluster and connected it to your K8s cluster, it is time to migrate and register the workloads (Nodes & Pods) into Ocean so they will be managed by Spotinst.
Instead of manually draining and re-scheduling your K8s pods on new nodes, Spotinst Ocean will completely automate the migration process.

Prerequisites:

  1. A K8s cluster running on AWS infrastructure. 
  2. A K8s cluster connected to an Ocean cluster. 
  3. Spotinst Controller version 1.0.44 installed in the cluster
  4. Kubernetes Cluster Auto-Scaler Deactivated
    Caution: In case the Kubernetes Auto-Scaler is active, there will be inconsistency in spinning up new nodes.
Workload Migration
After you have successfully completed creating your Ocean cluster, click on “Workload Migration” on the top right corner. Workload Discovery

Spotinst Ocean will automatically detect the workloads (Nodes & Pods) which belong to the Kubernetes cluster associated with it.

In the following screen, Ocean will display all the nodes that it discovered.

  • From the list on the left, select the instances you wish to migrate into your Ocean cluster by clicking on the relevant checkbox.
Workload Migration Preferences 
  • Select your preferred Workload Migration process by selecting the relevant checkbox:
    1. Terminate Instances – By selecting this checkbox, Spotinst Ocean will terminate the old instances once the pods that reside on them are migrated, and the old instances are fully drained. 
    2. Evict stand-alone Pods – By selecting this checkbox, Spotinst Ocean will terminate pods that don’t belong to a Kubernetes deployment, this practically means that you would need to launch the Pod manually (after the migration) due to the fact that there is no object that would do it automatically.
      Note: In case you have Stand-Alone pods and you haven’t selected this checkbox, please note that you will be required to manually evict those pods at the end of the migration process. 
    3. Force PDB covered Pod Eviction – By selecting this checkbox, Spotinst Ocean will force the Pod eviction from the instance, even if the distributed budget is not satisfied.
  • Select the batch size (in %) you wish to apply, by toggling the bar.
    • The value varies between 1%-20%
    • If for example, you select 20%, this practically means that 20% of the instances will be migrated simultaneously.
Start Migration 
  • After you have selected the relevant instances and decided on the migration scope and batch size, click on “Start Migration” on the bottom right corner in order to begin the process.
    Note: After clicking on “Start Migration” there will be a pop-up screen where you can have a final review of the migration configuration.

  • Click on “Start Migration” to officially begin the migration process
    Note: Once you have started the migration, you will have the option to stop it, however, please note, that workloads that have been migrated to Spotinst, will remain under the new instances which are managed by Spotinst. This means that when aborting the process will, Spotinst will finish scheduling all unscheduled pods of the current batch, and instances that were not drained yet will become schedulable again.
Workload Migration Dashboard

During the migration, you will have complete visibility into the process, please refer to the legend below the screenshot for a more detailed explanation:

  1. The overall status of the migration process:
    1. Running – The migration process is concurrent and pods are being migrated.
    2. Stopping – The migration process has been aborted by the user, and Spotinst is gracefully completing the current batch.
    3. Stopped – The migration process has officially stopped, after completing the stopping phase.
    4. Completed – The migration process has completed successfully.
    5. Failed – The migration process has failed due to technical fault during the process.
  2. The stage of the migration process
  3. The number of new instances spun up by Spotinst – This number will rise from 0 to X during the first few minutes of the migration process.
  4. The number of pods launched on new instances – This number will rise as the migration proceeds, please note that Kubernetes might schedule other pods which don’t belong to the workloads being migrated.
  5. The number of pods remaining to be launched by Spotinst – This number will subtract from X to 0 during the migration process.
  6. The number of unscheduled pods in the cluster – The number of pods that are currently in an unscheduled state. Spotinst refers only to unscheduled pods which are a part of the workload.
  7. The instances which have been terminated successfully
  8. The instances which have completed the migration successfully
  9. The instances which are currently being drained
  10. The instances which haven’t started the migration process
    Instances Color Status:
    • Green: Instance has completed the migration successfully 
    • Yellow: Instance has partially completed the migration
    • Red: Instance has failed the migration 
  • In case you wish to review previous migrations, please click on “Previous Migrations” on the top right corner of the “Workload Migration” screen.

Abort Migration
  • In case you wish to abort the migration process, click on “Stop Migration” on the top right corner.
  • The following window will pop up, select the checkbox “Terminate Drained Instances” if you want Spotinst Ocean to terminate the already drained instances before aborting the entire process, then select “Yes, Stop”.