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": 180,
    "resourceLimits": {
      "maxMemoryGib": 1500,
      "maxVCpu": 750
    },
    "down": {
      "evaluationPeriods": 3,
      "maxScaleDownPercentage": 60
    },
    "headroom": {
      "cpuPerUnit": 2000,
      "memoryPerUnit": 0,
      "gpuPerUnit": 1,
      "numOfUnits": 4
    },
    "isAutoConfig": false
  },
  "capacity": {
    "minimum": 0,
    "maximum": 1000,
    "target": 1
  },
  "strategy": {
    "fallbackToOd": true,
    "utilizeReservedInstances": true,
    "drainingTimeout": 60
  },
  "scheduling": {
	"shutdownHours": {
		"isEnabled": true,
        "timeWindows": [
          "Fri:15:30-Wed:14:30",
          "Wed:15:30-Thu:18:30"
		]
	}
  },
  "security": {
  	"containerImage": {
      "approvedImages": [
		"*.ecr.*.amazonaws.com/*",
        "docker.*"
      ]
    }
  },
  "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"
        }
      ],
      "loadBalancers": [
        {
          "name": "MyTargetGroup",
          "arn":"arn:aws:elasticloadbalancing:us-west-2:922761411234:targetgroup",
          "type": "TARGET_GROUP"
        },
        {
          "name": "MyClassicLB",
          "type": "CLASSIC"
        }
      ],
      "associatePublicIpAddress" : true,
      "monitoring": false,
      "ebsOptimized": false,
      "rootVolumeSize": 73
      }
    }
  }
}

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. resourceLimits.maxMemoryGib Integer
    The maximum memory in GiB units that can be allocated to the cluster.
  • cluster.autoScaler. resourceLimits.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.down.maxScaleDownPercentage Integer
    Would represent the maximum % to scale-down. Number between 1-100
  • 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.gpuPerUnit Integer
    How much GPU allocate for headroom unit
  • 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
  • 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.strategy.drainingTimeout Integer
    The draining timeout (in seconds) before terminating the instance. If no draining timeout is defined, the default draining timeout will be used.
    Example: 60
  • cluster.scheduling Object
    Set scheduling object
  • cluster.scheduling.shutdownHours Object
    Set shutdown hours for cluster object
  • cluster.scheduling.shutdownHours.isEnabled Boolean
    Flag to enable / disable the shutdown hours.
    Example: True
  • cluster.scheduling.shutdownHours.timeWindows * Array<String>
    Set time windows for shutdown hours. specify a list of 'timeWindows' with at least one time window Each string is in the format of - ddd:hh:mm-ddd:hh:mm ddd = day of week = Sun | Mon | Tue | Wed | Thu | Fri | Sat hh = hour 24 = 0 -23 mm = minute = 0 - 59. Time windows should not overlap. required on cluster.scheduling.isEnabled = True.
    Example: Fri:15:30-Wed:14:30
  • cluster.security Object
  • cluster.security.containerImage Object
  • cluster.security.containerImage.approvedImages Array<String>
    Set white list of repositories for container images.
  • 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
    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.
  • cluster.compute.launchSpecification.loadBalancers Array<Object>
    Configure load balancers settings to Ocen cluster
  • cluster.compute.launchSpecification.loadBalancers.type String
    Type of LB to use. supported types are: "TARGET_GROUP" "CLASSIC"
  • cluster.compute.launchSpecification.loadBalancers.arn String
    If type is "TARGET_GROUP"than ARN is required
  • cluster.compute.launchSpecification.loadBalancers.name String
    If type is "CLASSIC"than name is required, otherwise it's optional
  • cluster.compute.launchSpecification.associatePublicIpAddress Boolean
    Configure public IP address allocation
    Default: False
  • cluster.compute.launchSpecification.monitoring Boolean
    Enable detailed monitoring for cluster. Flag will enable Cloud Watch detailed detailed monitoring (one minute increments). Note: there are additional hourly costs for this service based on the region used
  • cluster.compute.launchSpecification.ebsOptimized Boolean
    Enable EBS optimized for cluster. Flag will enable optimized capacity for high bandwidth connectivity to the EB service for non EBS optimized instance types. For instances that are EBS optimized this flag will be ignored
  • cluster.compute.launchSpecification.rootVolumeSize Integer
    Set root volume size in GiB
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
                },
                "strategy": {
    				"fallbackToOd": true,
    				"utilizeReservedInstances": true,
    				"drainingTimeout": 60
  				},
                "scheduling": {
                  "shutdownHours": {
                      "isEnabled": true,
                      "timeWindows": [
                        "Fri:15:30-Wed:14:30",
                        "Wed:15:30-Thu:18:30"
						]
					}
				},
                "security": {
                  "containerImage": {
                    "approvedImages": [
		              "*.ecr.*.amazonaws.com/*",
                      "docker.*"
                    ]
                  }
                },
                "compute": {
                    "subnetIds": [
                        "subnet-cb6c3ab2"
                    ],
                    "instanceTypes": {
                        "whitelist": [
                            "c3.large"
                        ]
                    },
                    "launchSpecification": {
                        "securityGroupIds": [
                            "sg-c3d914b0"
                        ],
                        "iamInstanceProfile": {},
                        "tags": [
                            {
                                "tagKey": "or",
                                "tagValue": "from"
                            }
                        ],
                      	"rootVolumeSize": 73
                    }
                },
                "createdAt": "2018-11-05T13:13:41.888+0000",
                "updatedAt": "2018-11-05T13:13:41.888+0000"
            }
        ],
        "count": 1
    }
}