Demo: Cluster setup on AWS using kops
This article will take you through Kubernetes cluster setup on AWS using kops tool.
Following are the steps to setup cluster.
1. Login toUbuntu xenial box (vagrant up && vagrant ssh)
2. Download the kops tool on Ubuntu box.
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
3. Make the kops binary executable.
$ chmod +x kops-linux-amd64
4. Move the binary in to your PATH.
$ sudo mv kops-linux-amd64 /usr/local/bin/kops
5. Test to ensure the version you installed is up-to-date:
$ kops version
6. Create new SSH keys – These SSH keys will be used to login to the cluster. Create SSH key with the name of your cluster, so that you can easily differentiate cluster SSH key and other SSH keys.
ssh-keygen -t rsa -b 4096 -f ./k8s.timesofcloud.com
Above command will create a pair of SSH keys (a Public Key, and a Private key)
We will be uploading k8s.timesofcloud.com.pub public key to our cluster instances (VMs). That way we will be able to login to our Nodes (VM) using Private key k8s.timesofcloud.com
7. Below is the command to create the
kops create cluster –name=k8s.timesofcloud.com --state=s3:// k8s.timesofcloud.com --zones=eu-west-1a --node-count=2 --node-size:t2.micro --dns-zone=k8s.timesofcloud.com
Run a pod on cluster to verify Kubernetes is working:
$ kubectl run hello-minikube –image=k8s.grc.io/echoserver:1.4 –port=8080
$ kubectl export deployment hello-minikube –type=NodePort
$ kubectl get svc
Watch below video to see demo of cluster creation.
372 total views, 1 views today