Kubernetes on AWS: Kops

Step by Step guide to building a container orchestration solution for Devs

Prep: Add/Export your access key and secret access key for awscli to function.

The following IAM permissions are required to function properly:

  • AmazonEC2FullAccess
  • AmazonRoute53FullAccess
  • AmazonS3FullAccess
  • IAMFullAccess
  • AmazonVPCFullAccess

0> ssh-keygen -t rsa

1> [ download kops & kubecrl ] * see requirements below

2> aws s3 mb k8s.lifetouch.us

3> export KOPS_STATE_STORE=s3://k8s.lifetouch.us

4> export NAME=lifetouch.us

5> kops create cluster --zones us-east-1c ${NAME}
I0920 22:18:56.111767 6770 create_cluster.go:659] Inferred --cloud=aws from zone "us-east-1c"
I0920 22:18:56.112460 6770 create_cluster.go:845] Using SSH public key: /root/.ssh/id_rsa.pub
I0920 22:18:56.162206 6770 subnets.go:183] Assigned CIDR 172.20.32.0/19 to subnet us-east-1c

6> kops update cluster ${NAME} --yes

7> kubectl get nodes

NAME STATUS AGE VERSION
ip-172-20-33-44.ec2.internal NotReady 12s v1.7.2
ip-172-20-42-150.ec2.internal Ready 2m v1.7.2
ip-172-20-42-165.ec2.internal NotReady 17s v1.7.2

8> kubectl get nodes

NAME STATUS AGE VERSION
ip-172-20-33-44.ec2.internal Ready 1m v1.7.2
ip-172-20-42-150.ec2.internal Ready 3m v1.7.2
ip-172-20-42-165.ec2.internal Ready 1m v1.7.2

9> ssh to the master: ssh -i ~/.ssh/id_rsa admin@api.lifetouch.us

10> kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

serviceaccount "kubernetes-dashboard" created
clusterrolebinding "kubernetes-dashboard" created
deployment "kubernetes-dashboard" created

11> cat ~/.kube/config

..........
username: admin
password: x8MTmskS34wraPpAYsVpu9ReCFMdNNRI

Login to dashboard:
https://api.lifetouch.us

BUILD IMAGES and PUSH TO AWS

0> git clone https://github.com/ardeshir/dock8s.git

1> cd dock8s

2> docker build -t nodejs .

CREATE A REPO, login and push your docker images

Documentation