Auto-Scaling Kubernetes on DigitalOcean with Supergiant

Posted by Brian Sage on December 20, 2016

By the time this tutorial is over, you will have used Supergiant to deploy an auto-scaling Kubernetes cluster on DigitalOcean.

This will keep hardware costs as low as possible while providing auto-scaling performance when it is needed.

For this tutorial, you will need:

  • A running Supergiant installation
  • DigitalOcean API Access Token with Read and Write permissions
  • Your SSH key fingerprint from the DIgitalOcean Dashboard > Click profile avatar > Settings > Security
  • A region that supports block storage where you want to deploy your Kubernetes cluster. As of this writing, it should be one of FRA1, NYC1, or SFO1.

Note: This is an article in a series to help get Kubernetes running quickly on DigitalOcean using Supergiant. If a Supergiant server is not yet running, see: How to Run a Supergiant Server on DigitalOcean

Kubernetes on DigitalOcean Hardware that Auto-Scales for You

We’re excited to release a Supergiant provider layer for DigitalOcean. DigitalOcean has emerged as an incredibly fast-growing and inexpensive cloud hardware provider that has had great success standing up to behemoths in their space. Not only are their droplet prices incredibly reasonable, but we’ve also found their provisioning performance faster than most other providers out there, making them an ideal host for auto-scaling Kubernetes.

Let’s get started.

Step 1: Login to the Supergiant Dashboard

To log in to Supergiant, you will need an admin username and password. You either created this on Supergiant first run (see installation tutorial), or you will need to be given a username and password from your Supergiant administrator.

Step 2: Add Cloud Credentials

Click to visit the Cloud Accounts view, and click to create a new entry with your DigitalOcean API access token.

Your credentials will need DigitalOcean API v2 read and write permissions.

Enter the following and click Create.

{
  "credentials": {
    "token": "YOUR APIv2 ACCESS TOKEN"
  },
  "name": "WHATEVER CLEVER NAME YOU LIKE",
  "provider": "digitalocean"
}

After the cloud account is created, remember the name you’ve given it, because you will use it in the next step. You can always look it up again in the Cloud Accounts dashboard view.

Step 3: Create a Kube

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

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

  • "cloud_account_name": the name of the Cloud Account you created above
  • "region": the region you would like to launch your Kubernetes cluster. Must be a region that supports DigitalOcean's Block Storage. Example: “nyc1”
  • "ssh_key_fingerprint": the fingerprint of the public key that will be authorized to access the Kubernetes API. Retrieve this from DIgitalOcean Dashboard > Click profile avatar > Settings > Security
  • "master_node_size": the instance size for your Kubernetes master; the value you enter here will depend on what options are available to your Supergiant config JSON file; 512MB of RAM is sufficient.
  • "name": a name for your Kube that starts with a letter, limited to 12 characters, made of lowercase letters, numbers, and/or dashes (`-`)
  • "node_sizes": build an array of DigitalOcean node sizes chosen from sizes contained in the Supergiant config/config.json file. This list will be used to provision hardware for auto-scaling Kubernetes.

My configuration looks like this:

{
  "cloud_account_name": "digitalocean",
  "digitalocean_config": {
    "region": "nyc1",
    "ssh_key_fingerprint": "MY SSH KEY FINGERPRINT"
  },
  "master_node_size": "512mb",
  "name": "tutkube",
  "node_sizes": [
    "512mb",
    "1gb",
    "2gb",
    "4gb",
    "8gb",
    "16gb",
    "32gb",
    "48gb",
    "64gb"
  ]
}

When your edits are complete, click Create.

Step 4: Watch Supergiant Go!

Supergiant will orchestrate provisioning of DigitalOcean services, including block storage, security settings, networking, and more. When it is finished, it will provision your master and minion instances and will display log output as it goes.

The longest wait time will be “waiting for Kubernetes” as you wait for the DigitalOcean instance to be provisioned. Just be patient; DigitalOcean is working very hard for you.

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 in the Supergiant dashboard.

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 on DigitalOcean!

Teardown

If you want to tear down your tutorial Kube, from the Supergiant dashboard, 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 DigitalOcean 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 the Supergiant 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