curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y python3-pip apt-transport-https kubectl
pip3 install awscli --upgrade
export PATH="$PATH:/home/ubuntu/.local/bin/"
curl -Lo kops 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
sudo mv kops /usr/local/bin/kops
Important
Amazon S3 bucket name must be unique
Create S3 bucket to store the state of your cluster
aws s3api create-bucket --bucket kops-storage --region us-east-1
To implement versioning your S3 bucket in case you ever need to revert or recover a previous state store (Optional)
aws s3api put-bucket-versioning --bucket kops-storage --versioning-configuration Status=Enabled
Create the cluster
kops create cluster --name=demok8scluster1.k8s.local --state=s3://kops-storage --zones=us-east-1a --node-count=2 --node-size=t2.medium --control-plane-size=t2.medium --control-plane-volume-size=15 --node-volume-size=15
Build the cluster
kops update cluster demok8scluster1.k8s.local --yes --state=s3://kops-storage
To delete the cluster
kops delete cluster --name demok8scluster1.k8s.local --yes --state=s3://kops-storage
Note
All instances created by kops will be built within ASG (Auto Scaling Groups), which means each instance will be automatically monitored and rebuilt by AWS if it suffers any failure.