In this post I’ll outline the basics of getting Kubernetes running on top of AWS. When we are done, you should have a Kubernetes cluster running atop of AWS with a simple web application that is publicly accessible.
What is Kubernetes?
Simply put, Kubernetes is an open source container management system. Some notable features include automatic deployment, scaling, and lifecycle management. Sounds snazzy right? Right. But you’re probably asking what does this really mean. Kubernetes is a simple way to deploy containers in a straightforward and scalable way. Kubernetes provides an abstraction over the raw resources that make up a cluster (compute instances, load balancers, etc). Give Kubernetes a container to run and it will run it. DNS? It has you covered. Load balance a group of containers? Done. But wait you just added that fancy new feature to your web app and you want to deploy with zero downtime. No problem, Kubernetes can do that for you, too. All in all, Kubernetes provides all the faculties needed to support your service-oriented architecture.
Before we begin, you will need the following:

A Brief Detour
We’ve hardly started and we’re taking a brief detour? Yes, I’m sorry. I want to take a moment to talk about the various ways one can turn up a new Kubernetes cluster on AWS. Kubernete’s documentation takes you through using their kube_up script. They also provide a nifty one liner that gets you from zero to Kubernetes on AWS pretty quickly; kube_up is great for quickly spinning up test clusters but I’ve found it lacking in long-term management of a cluster. Enter kops. Kops is an open source Kubernetes cluster lifecycle management tool. Though a work in progress, I’ve found kops to be a good balance between “it just works” and a tweakable tool. This is what we will be using to turn up our very own Kubernetes cluster. Full disclosure, there are many more ways to turn up a cluster that I have not tested.
Turn up for Kubernetes
Let’s get started. First, let’s grab a copy of the kops tool.

go get -d
cd ${GOPATH}/src/

Let’s run a quick sanity check to make sure everything was installed correctly.

${GOPATH}/bin/kops help

You should see something that resembles

Hanks-MacBook-Pro:~ hank$ ${GOPATH}/bin/kops help
kops is kubernetes ops.
It allows you to create, destroy, upgrade and maintain clusters.
kops [command]
Available Commands:
create create resources
delete delete clusters
describe describe objects
edit edit items

With kops installed, we have some decisions to make.
First, decide which S3 bucket you’d like kops to use to store your cluster configuration. Let’s call this piece of information STATE_STORE.
Next, decide what’d you like to name the cluster. This should be a DNS name that ends in the domain you have as a hosted zone within Route 53. For example, if your domain is, you might want to choose as the name. We will call this NAME.
Now, we need to decide what our initial infrastructure configuration will be. kops supports a plethora of flags that allow us to do this. We will only be using a few for this article. Don’t worry, all of this can easily be updated later. For the sake of this article (and for cost reasons), we will launch our cluster in us-east-1a and us-east-1c using t2.small instances for the nodes and the master. Though not applicable to what we will be doing below, kops supports creating the cluster with high availability masters.
Using the above information, we have all we need to create our cluster. kops breaks this down into two concrete steps: generating the cluster configuration and building the cluster.
Before we run these commands, let’s setup our environment variables, replacing {S3_BUCKET_NAME} and {CLUSTER_NAME} with their appropriate values.


To generate the cluster configuration, run:

${GOPATH}/bin/kops create cluster –state=${STATE_STORE} –cloud=aws –zones=us-east-1a,us-east-1c –node-count=2 –node-size=t2.small –master-size=t2.small ${NAME}

To create cluster, run:

${GOPATH}/bin/kops update cluster –state=${STATE_STORE} ${NAME} –yes

Once that command completes, it will take a few minutes for the cluster to become fully operational. To check the cluster run:

kubectl get nodes

The launch has succeeded once there are three nodes listed by that command (2 nodes + 1 master).
That’s it! Congratulations on your new cluster. If you want help setting up your Kubernetes or any other orchestration tool, our DevOps team will be happy to help.
More Information: