Prerequisites

  1. Ensure that you are in the correct cluster context for kubectl.
  2. If you are importing a cluster, the cluster name must be the same as the primary instance group name.
  3. Before doing a workload migration, ensure that there are no unscheduled pods. If there are unscheduled pods, the migration will stop.

Option 1: Hybrid – Migrate selected of an existing cluster managed by AWS Auto Scaling Groups to Ocean

This procedure requires KOPS version 1.15 or later.

This section describes how to perform a hybrid migration. This enables you to migrate only some or all of the worker instance groups, while leaving the master nodes, and any remaining worker node groups to be managed in an AWS ASG.

1. Enable Spot support by toggling the feature flag on the management station where KOPS commands are run:

export KOPS_FEATURE_FLAGS="+Spotinst,SpotinstOcean,SpotinstHybrid"

2. Ensure that Spotinst environment variables are defined on the KOPS management server:
SPOTINST_TOKEN and SPOTINST_ACCOUNT

Worker Node Migration

In the case of multiple worker node Instance Groups:
1. Set the Ocean default launch specification label: spotinst.io/ocean-default-launchspec: "true"   and the spotinst.io/hybrid: "true" label on your primary Instance Group.
Example:

apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
labels:
  kops.k8s.io/cluster: kops.k8s.com
  spotinst.io/hybrid: "true"
  spotinst.io/ocean-default-launchspec: "true"
name: nodes
spec:
...

2. Label the rest of the instance groups you want to migrate to Ocean with the label spotinst.io/hybrid: "true".
Example:

apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
 creationTimestamp: null
 labels:
   kops.k8s.io/cluster: kops.ek8s.com
   spotinst.io/hybrid: "true"
 name: nodes
spec:
...

a. Run KOPS Update
KOPS will now identify and create the Ocean Cluster along with the Ocean launch specifications for each labeled instance group.

b. Workload Migration

Option 1:
Spot Automated Workload Migration

Option 2:

      1. Gradually scale down your existing Auto Scaling Groups to zero.
      2. Ocean will automatically provision the required instances to ensure your pods are scheduled.

3. Clean up (optional):

a. Delete imported Auto Scaling Groups.

b. Delete all Launch Configurations.

Option 2: Migrate Master and Worker Nodes of an Existing Cluster Managed by AWS Auto Scaling Groups to Ocean

The migration of existing deployment will consist of two separate layers: master nodes and worker nodes’ Instance Group(s). Both will be imported.

  1. Enable Spotinst support by toggling the feature flag. On the management station where KOPS commands are run:

    export KOPS_FEATURE_FLAGS="+Spotinst,SpotinstOcean"
  2. Ensure that Spot environment variables are defined on the KOPS management server:
    SPOTINST_TOKEN and SPOTINST_ACCOUNT
Worker Nodes
  1. In a case of a single Instance Group there is no need to add any labels and you may skip this step. Set the Ocean default launch specification label: spotinst.io/ocean-default-launchspec: “true”   on your primary Instance Group.
    Example:

    apiVersion: kops/v1alpha2
    kind: InstanceGroup
    metadata:
    labels:
      kops.k8s.io/cluster: kops.k8s.com
      spotinst.io/ocean-default-launchspec: "true"
    name: nodes
    spec:
    ...

2. Run KOPS Update.
KOPS will create an Ocean Cluster Elastigroup for each Instance group with a master role and an Ocean launch specification for each KOPS Instance group.

3. Workload Migration

Option 1:
Spot Automated Workload Migration

Option 2:

        1. Gradually scale down your existing Auto Scaling Groups to zero.
        2. Ocean will automatically provision the required instances to ensure your pods are scheduled.

4. Clean up (optional):

        1. Delete all Auto Scaling Groups.
        2. Delete all Launch Configurations.