Auto-Scaling Kubernetes Cluster on AWS EC2 with Supergiant

Posted by Brian Sage on September 19, 2016

By the end of this very brief tutorial, you will successfully deploy a Kubernetes cluster using Supergiant on AWS EC2, and it won’t take long at all.

Your cloud hardware will auto-scale according to the parameters you set to keep costs as low as possible. AWS hardware usage rates apply.

Sound awesome? It is.

For This Tutorial, You Will Need:

Note: This is the second article in a series to help you get up and running quickly with Kubernetes using Supergiant. If Supergiant is not yet running, see our previous article: How to Install Supergiant Container Orchestration Engine on AWS EC2. This article has been updated for Supergiant 0.11.x.

 

Kubernetes that Auto-Scales for You

Administering container orchestration systems and cloud hardware can be tedious because computing needs change. For everyone. All the time.

We got tired of manually doing the same things over and over, so we created Supergiant’s packing algorithm to automatically handle the work of scaling up and scaling down. When you launch a Kube with Supergiant, the packing algorithm is already active, and there is nothing more you need to do to reap auto-scaling cost-saving benefits.

After these few steps, you will have an auto-scaling Kubernetes cluster, too. Let’s get started.

Step 1: Log in to Supergiant

To log in to Supergiant, if you haven’t created a user, you will need the generated admin password. To retrieve it, go to your AWS EC2 console and access the system log for your Supergiant server.


With the instance selected, click Actions > Instance Settings > Get System Log.


Find your Supergiant admin Username and Password near the bottom of the System Log.

Now that you have credentials, access the Supergiant dashboard using the public DNS address of your instance. This address will be shown in your EC2 console.

Log in with your admin Username and Password, and you will be taken to the Sessions view.


Welcome to the Supergiant dashboard! From the Sessions view, we can see that our session has been created, and we can see and administrate who else is logged in.

Step 2: Add Cloud Credentials

Click to visit the Cloud Accounts view, and click to create a new entry with an AWS access key and secret key with full administrator access.


Enter the following, and click Create.

{
    "credentials": {
        "access_key": "AWS ACCESS KEY",
        "secret_key": "AWS SECRET KEY"
    },
    "name": "ANY VALID JSON STRING",
    "provider": "aws"
}

After the cloud account is created, make a mental note of the Cloud Account ID that Supergiant assigns. You’ll use it in the next step.

Step 3: Create a Kube

Click to go to the Kubes view, and click to create a Kube.

You will be asked which cloud provider you prefer to use to create a Kube and its hardware. This tutorial contains examples for AWS; however, you may select any provider you like.

When you select a provider, the correct provider JSON syntax will be populated in the editor. There is nothing more happening in the background that that.


Some values will be pre-populated for you. Edit whatever you like, but be sure to edit or review the following entries:

  • "cloud_account_id": enter the ID number of the Cloud Account you created above. Since v0.11 "cloud_account_id" is replaced by "cloud_account_name". Enter the friendly name you gave your cloud account when you created it above.
  • “name”: enter a string that starts with a letter, limited to 12 characters, made of lowercase letters and numbers, and/or dashes (-).
    Note: On AWS, we recommend no dashes, as some AWS services can be finicky with dashes in certain places.
  • “node_sizes”: these are the AWS EC2 instance types Supergiant uses to provision new hardware while auto-scaling to meet demand, starting with the smallest size that fits your needs. We’ve had very reliable performance running Kubernetes on the M4 family of instances, so the list is pre-populated with M4 values. For a complete list, see AWS Instance Types.
  • “availability_zone”: AWS hardware availability changes depending on your account. At times, AWS will make some zones available to you, while some not. Supergiant can deploy a Kube to any zone available to you, so reference this knowledge article to discover which AWS Regions and AZs are available to you.
  • “region”: Must be updated to be compatible with your availability_zone choice. E.g., if availability_zone is us-west-2a, the region must be updated to us-west-2.

When your edits are complete, click Create.

Step 4: Watch Supergiant Go!

Supergiant will orchestrate the provisioning of AWS services, including security settings, load balancers, routing tables and more. Finally, it will provision your Kube master and Kube minion and will display log output as it does it.


The longest wait time will be “waiting for Kubernetes” as you wait for the EC2 instance to be provisioned and boot. This could take 5 minutes or longer, depending on what instance types you have selected. Just be patient. Your order is up next.

Any errors will also be displayed in the log as they happen. There is no need to refresh the browser window.

Access Kubernetes

Once the process completes, you may click on the Kube ID to get details. To verify Kubernetes is running, get the username, password, and master_public_ip from the Kube details.


From the Kube details view, get the username, password, and master_public_ip.

From your terminal, enter the following:

curl --insecure https://USERNAME:PASSWORD@MASTER_PUBLIC_IP/api/v1/

You should see a JSON response describing the API. Congratulations -- you’ve just launched an auto-scaling Kubernetes cluster!

Teardown

In case you want to tear down your tutorial Kube, simply click to view Kubes, select the one you wish to delete, and then select Delete from the Actions menu.

It’s as simple as that. Supergiant will clean up after itself and remove all the associated AWS services unique to the Kube.

Access the Supergiant Community

Remember, if you have trouble, or if you want to talk to other users about how they're making the most of Supergiant, our community hangs out on the Supergiant public Slack channel.

We would love any feedback you want to leave. We're working hard to add features that our community wants most, so all your comments are helpful to us. Visit our Slack channel, and post your questions and comments.

Where To Next?

This tutorial is one in a series to help you get started with Kubernetes using Supergiant. From here we recommend you check out the following:

comments powered by Disqus