Getting Started with Elastigroup for Amazon EKS
In this tutorial, you will learn how to create a new Amazon EKS cluster and import it with Elastigroup. Once imported, Elastigroup will manage and provision your workload on Spot Instances. With Spot Instances, you can achieve substantial cost savings (up to 80%) without compromising on performance or availability.
Step 1: Connecting your AWS Account
Login to Elastigroup and launch the Cloud Provider Wizard
Connecting your AWS account to the Spotinst Console is an easy and straight-forward process. When you first login Elastigroup, you will be greeted with the following screen that asks you to choose your cloud provider:
Choose Amazon Web Services and proceed with the remaining steps which consist of logging into your AWS account, deploying a cloud formation template, and copying the Spotinst RoleArn value.
When finished, you will be able to click on Connect Account and finish the setup.
After the account is linked, you will be asked to import your workloads. Click Other Use Cases to access the main Elastigroup page. With the account setup out of the way, let’s create an EKS cluster.
Step 2: Creating an EKS Cluster
Elastigroup makes it easy to deploy a new EKS cluster. Login to the Elastigroup Console and simply click on Create New EKS to begin the deployment.
The following dialog window will appear instructing you to click on the Launch
After clicking on Launch Stack, a new window or tab will open to CloudFormation in the AWS console. Click Next to proceed with the EKS deployment (make sure to chose the desired AWS region, as the cloud-formation template defaults to us-east-1).
The next window is where we can specify specific details for the stack.
Change the following parameters:
Stack name – Enter a unique name for this EKS deployment.
EKSClusterName – It is recommended to use the same name as Stack name for easy reference.
Spotinst Account ID – Available here.
Spotinst Access Token – Available here. Click create a new token to generate a new one or use an existing one.
Elastigroup name – It is recommended to use the same name as Stack name for easy reference.
AMIID – Use the appropriate AMI for your AWS region.
CapacityTarget – The group desired instances capacity.
CapacityMin – Enter 1
CapacityMax – Enter 3
SpotInstancesType – m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.16xlarge, m2.xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge
KeyName – Choose an existing EC2 Key Pair or create a new one.
In the above parameters, we are creating a single node Kubernetes cluster. With the CapacityMax value of 3, Elastroup will scale up to a maximum of three Kubernetes instances in the cluster based on the load. The SpotInstancesType section helps Elastigroup decide which Spot types to choose from the Spot market. Having more instance types defined here will increase the possibility to use Spot Instances to reduce costs by avoiding on-demand instances.
Click Next to proceed on this page and the next. On the final page, check the acknowledgment box following by Create. This process may take a few minutes to finish. The next step is to configure and install the Spotinst Kubernetes Controller so that the cluster can communicate with Elastigroup.
Step 3: Installing the Spotinst Kubernetes Controller
The Spotinst Kubernetes Controller enables communication between EKS and Elastigroup for Spotinst to manage the scaling of the cluster per load and workload requirements. Before the controller can be installed, we first need to configure kubectl to communicate with the EKS cluster with the following commands:
# aws eks update-kubeconfig –name cluster_name
# kubectl get svc
With kubectl configured, we will be able to install the parameters for the controller. Create a new file called configMap.yaml with the following contents:
Change the following values to match your setup:
- spotinst.token: <TOKEN> – The Spotinst access token
- spotinst.account: <ACCOUNT_ID> – The Spotinst account Id
- spotinst.cluster-identifier: <IDENTIFIER> – Use the Cluster name specified earlier
Save the file and then use kubectl to load the parameters into the cluster config:
# kubectl apply -f configMap.yaml
To install the controller and its dependencies, run the following command:
The last step for configuring Kubernetes with Elastigroup is to update the AWS authentication config map:
In the aws-auth-cm.yaml file, replace the <ARN of instance role (not instance profile)> snippet with the NodeInstanceRole value from the EKS CloudFormation Stack.
Apply the updated aws-auth-cm.yaml to the cluster.
# kubectl apply -f aws-auth-cm.yaml
After a minute or so, we should see the Kubernetes node in a ready state with kubectl:
# kubectl get nodes
NAME STATUS ROLES AGE VERSION
With Kubernetes up and running, you should now see a newly created Elastigroup in the Spostinst Console.
You have now learned how to import your Amazon EKS cluster into Elastigroup. With that out of the way, running your workloads on Spot Instances will have the following benefits:
- Cut your costs by up to 80%, while maintaining high availability.
- Run on Spot Instances with zero overhead, and no servers to manage – The Spotinst Elastigroup platform manages your infrastructure for you.
- Capacity Management – Simply scale the instances in your environment with Elastigroup to meet the needs of your workloads.
Learn more about using Elastigroup on Amazon Web Services in our documentation.