kops is an open source tool that allows you to orchestrate the creation of a Kubernetes Cluster on AWS. Let’s deploy a new Cluster by using it. We will be using the EC2 Instance that was created for the Docker portion of this Workshop.
Access your IAM Console and create a new Role called KOPS-Administrator
Attach the following policies to it:
AmazonEC2FullAccess
AmazonRoute53FullAccess
AmazonS3FullAccess
IAMFullAccess
AmazonVPCFullAccess
Using your EC2 Console, associate the IAM Role with your EC2 Instance
Access the Instance via SSH
Let’s deploy the necessary tools
Start by installing KOPS itself
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
sudo install kops /usr/local/bin
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
sudo install kubectl /usr/local/bin
pip install awscli
aws s3api create-bucket \
--bucket my-kops-cluster-state-for-today \
--region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1
export NAME=kops.k8s.local
export KOPS_STATE_STORE=s3://my-kops-cluster-state-for-today
aws ec2 describe-availability-zones --region eu-west-1
ssh-keygen
Press enter three times to accept insecure defaults
Generate your Cluster configuration and leverage at least two Availability Zones for it
kops create cluster \
--zones eu-west-1a,eu-west-1b,eu-west-1c \
${NAME}
kops edit cluster ${NAME}
kops update cluster ${NAME} --yes
kops validate cluster
kubectl get nodes
kubectl -n kube-system get po