Getting Started with kOps on Spot Ocean
Ocean seamlessly integrates with your existing instance groups, as a drop-in replacement for AWS Auto Scaling groups, and allows you to streamline and optimize the entire workflow, from initially creating your cluster to managing and optimizing it on an ongoing basis.
Simplify Cluster Management — Ocean’s Virtual Node Groups make it easy to run different infrastructure in a single cluster, which can span multiple AWS VPC availability zones and subnets for high-availability.
Container-Driven Autoscaling and Vertical Rightsizing — Auto-detect your container infrastructure requirements so the appropriate instance size or type will always be available. Measure real-time CPU/Memory consumption of your Pods for ongoing resource optimization.
Cloud-Native Showback — Gain a granular view of your cluster’s cost breakdown (compute and storage) for each and every one of the cluster’s resources such as Namespaces, Deployments, Daemon Sets, Jobs, and Pods.
Optimized Pricing and Utilization — Ocean not only intelligently leverages Spot Instances and reserved capacity to reduce costs, but also eliminates underutilized instances with container-driven autoscaling and advanced bin-packing.
Prerequisites
Make sure you have and installed kubectl.
Setup your environment
To use environment variables, run:
To use credentials file, run the spotctl configure command:
? Enter your access token [? for help] **********************************
? Select your default account [Use arrows to move, ? for more help]
act-0abcdefg (dev)
Or, manually create an INI formatted file like this:
[default]
token = <spotinst_token>
account = <spotinst_account>
and place it in:
Unix/Linux/macOS:
Windows:
%UserProfile%\.spotinst\credentials
AWS
Creating a Cluster
You can add an Ocean instance group to new or existing clusters. To create a new cluster with a Ocean instance groups, run:
# configure the feature flags
export KOPS_FEATURE_FLAGS="Spotinst,SpotinstOcean,SpotinstOceanTemplate"
# create the cluster
kops create cluster --zones=us-west-2a example
Note
It’s possible to have a cluster with both Ocean-managed and unmanaged instance groups.
# instancegroups.yaml
# A cluster with both Ocean-managed and unmanaged instance groups.
---
# Use Ocean in hybrid mode.
apiVersion: kops.k8s.io/v1alpha2
labels:
kops.k8s.io/cluster: "example"
spotinst.io/hybrid: "true"
...
---
# Use AWS Auto Scaling group.
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
labels:
kops.k8s.io/cluster: "example"
...
Creating an Instance Group
To create a new instance group, run:
# configure the feature flags
export KOPS_FEATURE_FLAGS="Spotinst,SpotinstOcean,SpotinstOceanTemplate"
# create the instance group
kops create instancegroup --role=node --name=example
To create a new instance group and have more control over the configuration, a config file can be used.
Label | Description | Default |
---|---|---|
spotinst.io/spot-percentage | Specify the percentage of Spot instances that should spin up from the target capacity. | 100 |
spotinst.io/utilize-reserved-instances | Specify whether reserved instances should be utilized. | true |
spotinst.io/utilize-commitments | Specify whether reserved instance commitments should be utilized. | none |
spotinst.io/fallback-to-ondemand | Specify whether fallback to on-demand instances should be enabled. | true |
Specify a period of time, in seconds, after a node is marked for termination during which on running pods remains active. | none | |
spotinst.io/grace-period | Specify a period of time, in seconds, that Ocean should wait before applying instance health checks. | none |
spotinst.io/ocean-default-launchspec | Specify whether to use the InstanceGroup’s spec as the default Launch Spec for the Ocean cluster. | none |
spotinst.io/ocean-instance-types-whitelist | Specify whether to whitelist specific instance types. | none |
spotinst.io/ocean-instance-types-blacklist | Specify whether to blacklist specific instance types. | none |
spotinst.io/ocean-instance-types | Specify a list of instance types that should be used by the Ocean Launch Spec. | none |
spotinst.io/autoscaler-disabled | Specify whether the auto scaler should be disabled. | false |
spotinst.io/autoscaler-default-node-labels | Specify whether default node labels should be set for the auto scaler. | false |
spotinst.io/autoscaler-auto-config | Specify whether headroom resources should be automatically configured and optimized. | true |
spotinst.io/autoscaler-auto-headroom-percentage | Specify the auto headroom percentage (a number in the range [0, 200]) which controls the percentage of headroom. | none |
spotinst.io/autoscaler-headroom-cpu-per-unit | Specify the number of CPUs to allocate for headroom. CPUs are denoted in millicores, where 1000 millicores = 1 vCPU. | none |
spotinst.io/autoscaler-headroom-gpu-per-unit | Specify the number of GPUs to allocate for headroom. | none |
spotinst.io/autoscaler-headroom-mem-per-unit | Specify the amount of memory (MB) to allocate for headroom. | none |
spotinst.io/autoscaler-headroom-num-of-units | Specify the number of units to retain as headroom, where each unit has the defined CPU and memory. | none |
spotinst.io/autoscaler-cooldown | Specify a period of time, in seconds, that Ocean should wait between scaling actions. | 300 |
spotinst.io/autoscaler-scale-down-max-percentage | Specify the maximum scale down percentage. | none |
spotinst.io/autoscaler-scale-down-evaluation-periods | Specify the number of evaluation periods that should accumulate before a scale down action takes place. | 5 |
spotinst.io/autoscaler-resource-limits-max-vcpu | Specify the maximum number of virtual CPUs that can be allocated to the cluster. | none |
spotinst.io/autoscaler-resource-limits-max-memory | Specify the maximum amount of total physical memory (in GiB units) that can be allocated to the cluster. | none |
spotinst.io/restrict-scale-down | Specify whether the scale-down activities should be restricted. | none |
Documentation
If you’re new to and want to get started, please checkout our Getting Started guide, available on the website.
Getting Help
- Join our community on Slack.
- Ask a question on and tag it with
spot-ocean
.