What is Kops? Kubernetes Cluster on AWS cloud | DevOps | VisualPath

Kubernetes Cluster on AWS cloud

What is Kops?
Kopslets you deploy production-grade, highly available, Kubernetes clusters from the command line. Deployment is currently supported on Amazon Web Services (AWS), with more platforms planned.
- Kubernetes Operations (kops) Production Grade K8s Installation, Upgrades, and Management
- The easiest way to get a production-grade Kubernetes cluster up and running.
- Works on Mac OS/Linux
We will set up a Linux VM with vagrant+virtualbox and setup Kops in the VM.
Kops on VM
• Setup vagrant and VirtualBox.
• Create a kops directory and bring up xenial64 VM.
• Bring up the VM
Copy the link of the latest Linux-amd64 version of Kops from GitHub.
Log in to the VM and download Kops

Make is executable & move to /usr/local/bin.
Install AWS cli

AWS setup for Kops

Create an S3 bucket in the region which you will use to store the state of KOPS.
Domain Name Setup
We need a domain name and few subdomains, we can set up both with AWS route53. I have domain name(devimranops.club) with Namecheap & subdomains in Route53. You can go with route53 for domain name and subdomain if you wish to.
§ Register a domain with any domain name provider like Godaddy or Namecheap or Route53. I have domain devimranops.club which I will use to demonstrate all the exercises with Kubernetes. 
Sub Domain Setup with AWS Route53
§ Go to AWS route53 dashboard => DNS management => Create Hosted Zone.
§ Domain name => kubernetes.<.Your Domain Name>
§ Make a note of four ns values you see after creating a subdomain.
NS Record setup with Domain Provider.
§ Go to your domain provider site.
§ Add NS record for the kubernetes subdomain. 
For Namecheap follow the below-mentioned procedure. Manage => Advanced DNS => Add new record. You must add the four ns record values as we had four ns server name in Route53.
 Don't use the ns server name mentioned in screenshot, use the one which you created with Route53.

AWS Cli setup
• Create an IAM user with full access and download its credentials file.
• Execute aws configure command in our VM and enter AWS access key and Secret Key fromcredentials.csv file. 

Setup Kubectl
• Installing and Setting Up kubectl Check the download page for the latest release url.
 

Setup SSH keys for cluster login
Renaming kops binary & test it
Setup Google DNS name server (8.8.8.8, 8.8.4.4)in our VM so VM can resolve kubernetes.<.Your Domain name>

Kubernetes.<.Your domain name> should be resolved to an ns record value after this. As displayed in the below screenshot its resolving for me
Setup Kubernetes Cluster
Now it’s showtime, we will create Kubernetes Cluster on AWS with Kops command. As of now we should have below mentioned setup ready from AWS.
• S3 bucket, my bucket name is kops-state-86.
• Complete domain name for our cluster, mine is kubernetes.devimranops.club.
• AWS cli setup with an Admin IAM user.
• AWS region, I am using us-west-1
• AWS zone, I am using us-west-1a
We need to supply all the values to the kops command as shown below. 

You should get an output as below, which shows cluster configuration is created by kops. The cluster has not yet created, follow next command to create it.
Kops update cluster to create the cluster.
Cluster setup would have been initiated, verify it by from AWS.
Verify Route 53 subdomains
Validate cluster with kops command.

Kops creates ~/.kube/config file where it writes all the config details for KUBECTL
We can now start using kubectl command to interact with our kubernetes cluster. Check the all the nodes in cluster.  
Let’s run a container on this cluster. 
• Deployment and service created, service is exposed on port 31496. We must allow port 31496 in Security group of Master node to access this service.
• Go to AWS Ec2 => Select Master node => Security groups =>masters.kubernetes. Inbound => Edit.
Add the port number and source from anywhere/MyIP. 

 • Get the master node Public IP and access it from browser on the exposed port.
 • Instead of Public IP of the master node, we can also use names assigned by Route53.
 • If you are not using the cluster you can delete it.


Comments