Setup a Kubernetes cluster in AWS under 20 minutes

** May vary based on kubernetes setup time **

I think developers should be thinking of taking advantage of this awesome technology. For a intro to kubernetes and its concept, checkout “Kubernetes for developers” by @jstrachan https://blog.fabric8.io/kubernetes-for-developers-2a9c7202fcd3#.3opz50t49

Let’s get started and have our first cluster running ASAP!

Step 1 — Setup AWS account (if you haven’t already!)

  • Setup Amazon AWS account — free tier will suffice. Follow the registration process at aws.amazon.com (Credit card and phone verification is an Amazon requirement)
  • After registration, go to AWS Console > IAM (Identity Access Management
AWS Services Catalog; IAM Highlighted in red-box
  • Create a new User, attach to Administrator Access Policy (overkill but quick)
IAM Users; Select “Add User” and follow the prompt
  • Save the CSV files containing credentials for future re-use

Step 2 — Setup and configure command line access

  • Download AWS CLI from — follow the prompts at https://aws.amazon.com/cli/
  • Once the AWS CLI is installed, runaws configure and use the credentials from Step 1 above.
  • aws iam list-users , should print out something like this:

Step 3 — Setup a new kubernetes cluster in EC2

  • Download kubernetes from www.github.com/kubernetes/kubernets/releases
  • Unzip and navigate to folder where kubernetes is unpacked
  • If you’re curious then checkout the default config file (for our purposes today, we won’t alter this):

$ vi cluster/aws/config-default.sh

  • Execute the kubernetes cluster setup process

$ KUBERNETES_PROVIDER=aws cluster/kube-up.sh

  • This will spin up our cluster and will take approximately 10 minutes to complete.

What did it do?

— New Amazon VPC (Virtual Private Cloud) : 172.20.0.*

— 5 Amazon EC2 Instances (4 minions + 1 master)

— Amazon ASG (Auto Scaling Group) for the minions

— SSH keys for direct access @ ~/.ssh/kube_aws_rsa

— kubectl is configured @~/.kube/config


Phew! We made it in time, didn’t we?

Reach out if you have any questions, happy to help. Enjoy your ride with kubernetes! And Thank You for reading :)

Like what you read? Give Saidur Rahman a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.