Deploy Kubernetes cluster with Kops and AWS s3 state

Published 01-03-2018 00:00:00

Install Kops on your local

Kops git repository: here

Prerequisite

kubectl is required, see here.

OSX From Homebrew

brew update && brew install kops

The kops binary is also available via our releases.

Linux

curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops

Create the AWS s3 Bucket

   aws s3api create-bucket \
    --bucket kubernetes.bucket.aws.s3.name \
    --region us-east-1

{
    "Location": "/kubernetes.bucket.aws.s3.name"
}

Create the Kubernetes cluster

This cluster have 3 master and 3 node(minion) for high havailability purpose

kops create cluster \
    --master-count=3 \
    --node-count 3 \
    --zones us-west-2a,us-west-2b,us-west-2c \
    --master-zones us-west-2a,us-west-2b,us-west-2c \
    --dns-zone kubernetes.cluster.com \
    --node-size t2.medium \
    --master-size t2.medium \
    --network-cidr=172.16.0.0/16 \
    --topology private \
    --networking weave \
    --bastion \
    --ssh-public-key=/root/.ssh/My_SSH_PUBLIC_KEY.key.pub \
infra.kubernetes.cluster.com