fbpx
POSThttps://api.spotinst.io/ocean/aws/k8s/cluster?accountId={ACCOUNT_ID}

Prerequisites

The Spotinst Controller is used to monitor the cluster resources and report back to Ocean and is required for Ocean On-Prem. To install the Spotinst Controller, complete and run the following script on a machine with kubectl command line tool installed and configured:

#!/usr/bin/env bash
curl -fsSL http://spotinst-public.s3.amazonaws.com/integrations/kubernetes/cluster-controller/scripts/init.sh | \
SPOTINST_TOKEN=<ENTER YOUR TOKEN HERE> \
SPOTINST_ACCOUNT=<ENTER YOUR SPOTINST ACCOUNT ID HERE> \
SPOTINST_CLUSTER_IDENTIFIER=<ENTER YOUR CLUSTER IDENTIFIER HERE> \
bash

For more on the Spotinst controller and Ocean’s anatomy see the documentation here.

 

URL Parameters

Parameter Type Description
ACCOUNT_ID * String

The Spotinst accountId associated with your token.

Example: act-123abc
Request

Headers
{
  "Authorization": "Bearer ${token}",
  "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "cluster": {
    "name": "oceanName",
    "controllerClusterId": "ocean.k8s",
    "region": "us-east-1",
    "autoScaler": {
      "isEnabled": true,
      "cooldown": 30,
      "resourceLimits": {
      	"maxMemoryGib": 1500,
        "maxVCpu": 750
      },
      "down": {
        "evaluationPeriods": 3
      },
      "headroom": {
        "cpuPerUnit": 2000,
        "memoryPerUnit": 0,
        "numOfUnits": 4
      },
      "isAutoConfig": false
    },
    "capacity": {
      "minimum": 0,
      "maximum": 1000,
      "target": 1
    },
    "strategy": {
      "spotPercentage": 100,
      "fallbackToOd": true,
      "utilizeReservedInstances": true
    },
    "compute": {
       "subnetIds": [
        "subnet-4c1d1538",
        "subnet-2791bb61"
      ],
      "instanceTypes": {
        "whitelist": [
          "c4.2xlarge",
          "c4.xlarge",
          "c4.4xlarge",
          "c4.8xlarge"
      ]
      },
      "launchSpecification": {
        "securityGroupIds": [
          "sg-c3d914b0"
        ],
        "iamInstanceProfile": {
          "arn": "orfrom"
        },
        "keyPair": "spotinst-labs-oregon",
        "tags": [
          {
            "tagKey": "creator",
            "tagValue": "orfrom"
          },
          {
            "tagKey": "k8s.io/role/node",
            "tagValue": "1"
          }
        ]
  }
              }
        }
}

Body Attributes


  • cluster Object
    The Ocean cluster.
  • cluster.name * String
    Add a name for the Ocean cluster.
  • cluster.controllerClusterId * String
    Enter the Ocean cluster identifier.
    Example: ocean.k8s
  • cluster.region * String
    Select the region for the Ocean cluster to run in.
    Example: us-east-1
  • cluster.autoScaler Object
    The Ocean Kubernetes Autoscaler.
  • cluster.autoScaler.isEnabled Boolean
    Enable the Ocean Kubernetes Autoscaler.
    Default: true
  • cluster.autoScaler.cooldown Integer
    Cooldown period between scaling actions.
    Default: null
  • cluster.autoScaler.resourceLimits Object
    Optionally set upper and lower bounds on the resource usage of the cluster.
  • cluster.autoScaler.maxMemoryGib Integer
    The maximum memory in GiB units that can be allocated to the cluster.
  • cluster.autoScaler.maxVCpu Integer
    The maximum cpu in vCpu units that can be allocated to the cluster.
  • cluster.autoScaler.down Object
    Auto Scaling scale down operations.
  • cluster.autoScaler.down.evaluationPeriods Integer
    The number of evaluation periods that should accumulate before a scale down action takes place.
    Default: null
  • cluster.autoScaler.headroom Object
    Spare resource capacity management enabling fast assignment of Pods without waiting for new resources to launch.
  • cluster.autoScaler.headroom.cpuPerUnit Integer
    Optionally configure the number of CPUs to allocate the headroom. CPUs are denoted in millicores, where 1000 millicores = 1 vCPU.
    Example: 2000
  • cluster.autoScaler.headroom.memoryPerUnit Integer
    Optionally configure the amount of memory (MB) to allocate the headroom.
  • cluster.autoScaler.headroom.numOfUnits Integer
    The number of units to retain as headroom, where each unit has the defined headroom CPU and memory.
  • cluster.autoScaler.isAutoConfig Boolean
    Automatically configure and optimize headroom resources.
    Default: true
  • cluster.capacity Object
    Capacity specifications for the Ocean cluster.
  • cluster.capacity.target Integer
    Number of instances to launch and maintain in cluster.
  • cluster.capacity.minimum Integer
    The bottom limit of instances that the cluster can scale down to.
  • cluster.capacity.maximum Integer
    The upper limit of instances that the cluster can scale up to.
    Default: 1000
  • cluster.strategy Object
  • clust.strategy.spotPercentage Integer
    The percentage of Spot instances the cluster should maintain. Min = 0, Max = 100
    Example: 50
    Default: 100
  • cluster.strategy.fallbackToOd Boolean
    If no Spot instance markets are available, enable Ocean to launch On-Demand instances instead.
    Default: true
  • cluster.strategy.utilizeReservedInstances Boolean
    If Reserved Instances exist, Ocean will utilize them before launching Spot instances.
    Default: false
  • cluster.compute * Object
  • cluster.compute.subnetIds * Array<String>
    A comma-separated list of subnet identifiers for the Ocean cluster. Subnet IDs should be configured with auto assign public IP.
  • cluster.compute.instanceTypes Object
    The type of instances that may or may not be a part of the Ocean cluster.
  • cluster.compute.instanceTypes.whitelist Array<String>
    Instance types allowed in the Ocean cluster.
    Cannot be configured if blacklist is configured.
  • cluster.compute.instanceTypes.blacklist Array<String>
    Instance types to avoid launching in the Ocean cluster.
    Cannot be configured if whitelist is configured.
  • cluster.compute.launchSpecification * Object
  • cluster.compute.launchSpecification.imageId * String
    ID of the image used to launch the instances.
  • cluster.compute.launchSpecification.userData Base64
    The Base64-encoded MIME user data to make available to the instances.
  • cluster.compute.launchSpecification.securityGroupIds * Array<String>
    One or more Security Group IDs.
  • cluster.compute.launchSpecification.iamInstanceProfile Object
  • cluster.compute.launchSpecification.iamInstanceProfile Object
    The instance profile iamRole.
  • cluster.compute.launchSpecification.iamInstanceProfile.arn String
    The iamRole arn.
  • cluster.compute.launchSpecification.keyPair String
    The key pair to attach the instances.
  • cluster.compute.launchSpecification.tags Array
    Optionally add tags to instances launched in Ocean cluster.
  • cluster.compute.launchSpecification.tags.tagKey String
    The tag key.
  • cluster.compute.launchSpecification.tags.tagValue String
    The tag value.
Response - 200

Body
Copied!
Downloaded!
{
    "request": {
        "id": "33a8c1d6-e882-4089-aa1c-6bd3ce54842d",
        "url": "/ocean/aws/k8s/cluster?accountId=act-594fb635",
        "method": "POST",
        "timestamp": "2018-11-05T13:13:41.907Z"
    },
    "response": {
        "status": {
            "code": 200,
            "message": "OK"
        },
        "kind": "spotinst:ocean:aws:k8s",
        "items": [
            {
                "id": "o-b05ca070",
                "name": "blacklistTest",
                "controllerClusterId": "from.opt.test4",
                "region": "us-west-2",
                "autoScaler": {
                    "cooldown": 180,
                    "down": {
                        "evaluationPeriods": 3
                    }
                },
                "capacity": {
                    "minimum": 0,
                    "maximum": 1000,
                    "target": 2
                },
                "compute": {
                    "subnetIds": [
                        "subnet-cb6c3ab2"
                    ],
                    "instanceTypes": {
                        "whitelist": [
                            "c3.large"
                        ]
                    },
                    "launchSpecification": {
                        "securityGroupIds": [
                            "sg-c3d914b0"
                        ],
                        "iamInstanceProfile": {},
                        "tags": [
                            {
                                "tagKey": "or",
                                "tagValue": "from"
                            }
                        ]
                    }
                },
                "createdAt": "2018-11-05T13:13:41.888+0000",
                "updatedAt": "2018-11-05T13:13:41.888+0000"
            }
        ],
        "count": 1
    }
}