Skip to content

Creating Kubernetes Cluster with KOPS

Install AWS CLI

apt update && apt install awscli -y
Configure AWS CLI with IAM user Credentials with a specific Region
aws configure

Note

If you are using AWS Instance better to use IAM Role than Creating User with Access-key

Check Whether AWS CLI Commands Working or not

aws s3 ls
Generate SSH Keys
ssh-keygen

Install kubectl binary with curl on Linux

Download the latest release with the command:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Install kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client

Installing Kubernetes with kops

Download the latest release with the command:

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
curl -LO https://github.com/kubernetes/kops/releases/download/v1.20.0/kops-linux-amd64

Make the kops binary executable

chmod +x kops-linux-amd64
Move the kops binary into your PATH.
sudo mv kops-linux-amd64 /usr/local/bin/kops
kops

Creating K8s Cluster with KOPS

Kops commands to setup k8s cluster:-

Creating S3 Bucket for Kubernetes Cluster

aws s3 mb s3:// <bucket name>
kops create cluster --name=saiteja.irrinki.xyz --state=s3://<s3 bucket> --zones=ap-south-1a,ap-south-1b --node-count=2 --node-size=t3.medium --master-size=t3.medium --dns-zone=saiteja.irrinki.xyz --node-volume-size=8 --master-volume-size=8
It will create a configuration of kops
kops update cluster --name=saiteja.irrinki.xyz --state=s3://<s3 bucket> --yes --admin
It will create kops data in the S3 bucket. It starts creating a cluster & it takes 10 mins
kops validate cluster --name=saiteja.irrinki.xyz --state=s3://<s3 bucket>
It shows ur cluster is ready

To Delete Cluster

kops delete cluster --name=saiteja.irrinki.xyz --state=s3://<s3 bucket> --yes