Image for post
Image for post
  1. Create Ubuntu EC2 instance

apt-get install update

  1. install AWS CLI

apt install awscli

apt-get install python

  1. Install kubectl

curl -LO -s

chmod +x ./kubectl

sudo mv ./kubectl /usr/local/bin/kubectl

  1. Create an IAM user/role with Route53, EC2, IAM and S3 full access
  2. Attach IAM role to ubuntu server

IAM user permission
The IAM user to create the Kubernetes cluster must have the following permissions:

AmazonEC2FullAccess
AmazonRoute53FullAccess
AmazonS3FullAccess
IAMFullAccess
AmazonVPCFullAccess

Note: If you create IAM user with programmatic access then provide Access keys.

aws configure

  1. Install kops on Ubuntu instance:

curl -LO -s | grep tag_name | cut -d ‘“‘ -f 4)/kops-linux-amd64

chmod +x kops-linux-amd64

sudo mv kops-linux-amd64 /usr/local/bin/kops

  1. Create a Route53 private hosted zone (you can create Public hosted zone if you have a domain)
  2. create an S3 bucket

aws s3 mb s3://dev.af.alvis.in

  1. Expose the environment variable:

export KOPS_STATE_STORE=s3://dev.af.alvis.in

  1. Create ssh keys before creating a cluster

ssh-keygen

  1. Create Kubernetes cluster definitions on S3 bucket

kops create cluster — cloud=aws — zones=us-east-1e — name=dev.af.alvis.in — dns-zone=alvis.in — dns private

  1. Create a Kubernetes cluster

kops update cluster dev.af.alvis.in — yes

  1. Validate your cluster

kops validate cluster

  1. To list nodes

kubectl get nodes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store