Auto-Scaling Kubernetes Cluster with OpenStack, Supergiant

Posted by Brian Sage on November 1, 2016

In this tutorial, we will show you how to use Supergiant to deploy an auto-scaling Kubernetes cluster on OpenStack.

OpenStack configurations can vary widely, so this tutorial is designed to make instructions as reproducible as possible across many OpenStack deployments; however, if you run into trouble, please join us on our Slack channel and ask any questions.

For This Tutorial, You Will Need:

  • A running Supergiant installation
  • OpenStack account credentials (as of OpenStack Newton):
    • Identity Endpoint URL (found under Project > Compute > Access & Security > API Access > Identity)
    • API Password (generated under Settings > API Password > Request API Password)
    • Project ID (found under Project > Compute > Access & Security > View Credentials > Project ID
    • User Name with full admin access to instances, networks, subnets, floating IPs, and routers
  • Kube parameters
    • Region where you want to deploy your Kubernetes cluster
    • An SSH public key for accessing your Kubernetes cluster
    • The ID of your OpenStack public gateway (found under Network > Network Topology > click the “World” > ID)

Note: This is an article in a series to help you get up and running quickly with Kubernetes on OpenStack using Supergiant. If Supergiant is not yet running, see Supergiant tutorials to get started.

Kubernetes on OpenStack Hardware that Auto-Scales for You

Containerization is the future; however, managing hardware for changing computing needs can still be tedious. OpenStack solves a lot of scaling problems for us, so we’re excited to release Supergiant provider drivers for OpenStack.

Now, OpenStack users can use Supergiant to install auto-scaling Kubernetes Kubes in almost no time. After these few steps, you will have a resource-efficient, auto-scaling Kubernetes cluster on OpenStack, 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 admin user and password you created on Supergiant first-run.

Step 2: Add Cloud Credentials

Click to visit the Cloud Accounts view, and click to create a new entry with the OpenStack credentials listed above.

Your OpenStack credentials will need full administrator access to instances, networks, subnets, floating IPs, and routers.

Enter the following, and click Create.

{
  "credentials": {
    "identity_endpoint": "YOUR IDENTITY ENDPOINT URL",
    "password": "YOUR PASSWORD",
    "tenant_id": "YOUR PROJECT ID",
    "username": "YOUR USER NAME"
  },
  "name": "WHATEVER CLEVER NAME YOU LIKE",
  "provider": "openstack"
}

After the cloud account is created, remember the name you’ve given it. You’ll 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
  • “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
  • "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": this is an array of sizes specified in the Supergiant config/config.json file.
  • "region": The region in your OpenStack configuration you would like to launch your Kubernetes cluster. Example: "RegionOne"
  • "ssh_pub_key": paste the public key that will be authorized to access the Kubernetes API
  • "public_gateway_id": the ID of the OpenStack gateway or router that Supergiant should use when creating a floating IP for your Kubernetes API -- NOTE: you may choose to omit this key:value from this configuration, but you will need to manually configure a way for Supergiant to see the Kubernetes API to enable auto-scaling.

My configuration looks like this:

{
  "cloud_account_name": "tutstack",
  "master_node_size": "m1.smaller",
  "name": "tutkube",
  "node_sizes": [
    "m1.smaller",
    "m1.small"
  ],
  "openstack_config": {
    "region": "RegionOne",
    "ssh_pub_key": "ssh-rsa XXXXXXXX--my id_rsa.pub contents--XXXXXXXX",
    "public_gateway_id": "PUBLIC GATEWAY ID"
  }
}

When your edits are complete, click Create.

Step 4: Watch Supergiant Go!

Supergiant will orchestrate provisioning of OpenStack services, including security settings, gateways/routers, and more. When it is finished, it will provision your Kube master and Kube minion instances and will display log output as it goes.

The longest wait time will be “waiting for Kubernetes” as you wait for the OpenStack instance to be provisioned. This could take 5 minutes or longer, depending on what instance types you have specified. Just be patient; your OpenStack is working very hard for you.

NOTE: If your Supergiant server lies outside your OpenStack public gateway and port 443 is closed to the public, you may receive errors from the Supergiant Capacity Service. This is normal, as it is a part of how Supergiant polls and auto-scales instances. Consult your network security policy regarding whether to open port 443 for Supergiant’s Capacity Service.

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 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 OpenStack!

Teardown

In case 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 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