kops helps you create, destroy, upgrade and maintain production-grade, highly available, Kubernetes clusters from the command line. You can read details here.
In this article we will see how you can create Kubernetes cluster with one master and 2 nodes in AWS. This will be created from WSL (Windows Subsystem for Linux) on Win 10. Also the cluster will be created in your existing VPC.
Just to remind you this is very basic article fro beginners.
To get started, we need to get some tools ready before creating cluster-
- Install WSL on Win 10 server.
- Install kops (linux)
- Install kubectl (linux)
- Install awscli
- Install PuTTY & PuTTYgen
- Create VPC, s3 bucket, Hosted zone and Internet gateway.
Step 1 – Install WSL on Win 10 server
Follow the details provided in this doc – https://docs.microsoft.com/en-us/windows/wsl/install-win10
Install Ubuntu 18.04 LTS and create a user and password (while installing WSL it will ask for a user and password for OS user).
Step 2 – Install kops (linux)
Once WSL is installed and ready. Run the below commands to install kops-
run this command to make sure that kops installation was right– > kops version
Step 3 – Install kubectl (linux)
Run the below commands to install kubectl-
run this command to make sure that kubectl installation was right– > kubectl version
Step 4 – Install awscli
Run the below commands to install awscli-
Run aws configure command and set the AWS Access key and AWS Secret Access Key-
Step 5 – Generate ssh key
Run ssh-keygen to generate public/private key pair
You will find 2 files – id_rsa (private key) and id_rsa.pub (public key) created in ~/.ssh
Step 6 – Create minimum required AWS resources-
–>Hosted Zone (Route 53)
–>Internet gateway (attach to VPC)
–>S3 bucket to store the Kops state
Once these resources are created. Set the below variables with the values-
Run the below KOPS command to create the cluster-
Kops will create following resources-
-Private and public subnets
-EC2 instances (Master, Node & Bastion)
-Launch Configurations and Auto scaling groups
You can validate the cluster using below command-
kubectl validate cluster –state $KOPS_STATE_STORE –name $CLUSTER_NAME