Creating Kubernetes Cluster with KOPS

SAITEJA IRRINKI
2 min readSep 16, 2022

--

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/kubectlkubectl 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-amd64curl -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/kopskops

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

The S3 bucket will be filled with kops data. It takes 10 minutes for the cluster to be created

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

--

--

SAITEJA IRRINKI
SAITEJA IRRINKI

Written by SAITEJA IRRINKI

I’m SAITEJA IRRINKI Working as a Senior DevOps Engineer in Build & Release. Experienced in Provisioning and Managing Cloud Infrastructure.

No responses yet