https://github.com/pratikshinde55/aws-eks-setup
AWS Cloud Elastic Kubernetes Service setup and create Deployment and expose with using AWS_ELB load balancer.
https://github.com/pratikshinde55/aws-eks-setup
aws aws-eks-cluster eks-cluster eksctl horizontal-scaling kubectl kubernetes-cluster kubernetes-deployment pod replicas
Last synced: over 1 year ago
JSON representation
AWS Cloud Elastic Kubernetes Service setup and create Deployment and expose with using AWS_ELB load balancer.
- Host: GitHub
- URL: https://github.com/pratikshinde55/aws-eks-setup
- Owner: Pratikshinde55
- Created: 2024-08-06T11:35:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-06T10:55:30.000Z (over 1 year ago)
- Last Synced: 2025-02-06T11:34:12.582Z (over 1 year ago)
- Topics: aws, aws-eks-cluster, eks-cluster, eksctl, horizontal-scaling, kubectl, kubernetes-cluster, kubernetes-deployment, pod, replicas
- Homepage:
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elastic Kubernetes Service(EKS):
- kubernetes is Container cluster management tool.
- **Amazon EKS is Kubernetes cluster management service.**
- **Elastic Kubernetes Service(EKS) give fault tolerance(FT) means if something fail, Kubernetes master automatic launch Container.**
- **EKS give seamless facility.**
- **EKS also have multi master node setup.**
### EKS Main Component:
1. **Control plane:** In Master node of Kubernetes there are differents program run (Kube-schedular, KubeAPI, etcd) which control the kubernetes cluster nodes is termed as Control plane.
2. **Master Node:** Amazon EKS the master node is fully managed by AWS Cloud.
3. **Worker node:** The Worker node is not fully managed by AWS.
4. **kubelet:** Master node keeps on monitoring "pod" because there is a program running in "worker node" who communicates with master that program is known as **"kubelet"**, This is also managed by EKS.
5. **kube-schedular:** If we delete pod or any fault occures and pod goes down then Master node automatically launch same pod at any node, at any node means master **kube-schedular**
program keep on monitoring on worker node which is free, that node use for launch pod.
**We can create EKS cluster:-**
1. webUI
2. terraForm
3. eksctl

**Use "eksctl" to create eks cluster we need following things:**
1. IAM user (Create IAM user to access AWS EKS)
2. AWS cli (on local laptop for aws Authentication)
3. eksctl tool on local machine(Create Eks cluster).
4. kubectl tool on local machine(Do work inside cluster).
5. eksctl create cluster (Create cluster from local laptop).
6. AWS Console check(Cluster is created checking on aws console-->>EKS)
### Step-1: [Create IAM user on aws]
Go to aws console and create IAM user which is used for Authentication:

Now **attach policy** and create new user:

Now click on created user:

Now click **"security credentials"** and creare access key:


Retrieve **access key**:(Copy key)

### Step-2: [AWS CLI on local laptpton/ Authentication]
Search on google -->> "AWS CLI install window" -->> download AWS CLI for window (64-bit)
Command for checking AWS CLI work on prompt/ GitBash:
aws --version
Paste access key of IAM user:
aws configure

**This AWS CLI tool help us to connect with AWS and use AWS Services from laptop/Local machine.**
### Step 3: [Download eksctl tool]
**eksctl is third party tool to manage EKS.**
Search on browser "eksctl" open link and right side of link give GitHub repo link click ,
[eksctl-download-link](https://github.com/eksctl-io/eksctl/releases/tag/v0.188.0)

Now on GitHub there is option -->> "Release" click: (Download:- eksctl window amd64.zip)

- Note:
After Download eksctl tool we extract because we download zip file .
After extract eksctl tool we need to add path of eksctl tool to system -->>"Edit environment variable"
Go to "User variable for__" --> click "path" -->> Click "Edit" and here Add New path for extracted eksctl tool location:

Now on command prompt/ GitBash we can check by using command :
eksctl
eksctl version

- Note:
"eksctl" command for only create and delete cluster but not for doing cluster inside activities or for worker node.
"eksctl" tool helps to connect with master through "kubeAPI" but we Master node is fully managed by aws.
### Step-4: [Download Kubectl on loptop]
Search on browser 'kubectl install window' -->> 'Install kubectl binary with curl on Windows ' -->> copy command and paste on local system.
[Kubectl-download-link](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/ )
curl.exe -LO "https://dl.k8s.io/release/v1.30.0/bin/windows/amd64/kubectl.exe"
We can check using command:
kubectl version

### Step-5: [Create EKS Cluster]
**For creating Cluster we use "eksctl" command and for doing anything inside cluster we use "kubectl" command.**
Create kubernetes cluster we use help command for showing option:
eksctl create cluster --help
Create eks cluster using option command:
eksctl create cluster --name pscluster --region ap-south-1 --version 1.30 --nodegroup-name psnodegp --instance-types t2.micro --nodes 3 --nodes-min 3 --nodes-max 6 --node-volume-size 8 --node-volume-type gp3 --ssh-access --enable-ssm --instance-name psworkernode --managed

eksctl get cluster --region ap-south-1
To Check node group:
eksctl get nodegroup --cluster pscluster --region ap-south-1
### Step-6: [Create pod using Docker image]
- **If we want to launch OS, Server, App then that entire Software we bundle in one box or software called as "Image" and that image in Container world called as "Container Image".**
- **If we want to launch app/container/pod with help of image we use term as "deployment" in K8S world.**
Command for create deployment/container in AWS EKS:
kubectl create deployment psapp --image=vimal13/apache-webserver-php
We can check pods using kubectl command:
kubectl get pods

To check nodes CPU and RAM:
kubectl top nodes
We can check entire info of pods using command:
kubectl get pods -o wide
We can also direct connect to POD (Container) from laptop:
kubectl exec -it myweb-59f99ddd48-kvnpv -- bash
Try Also this:
kubectl exec -it psapp bash

### Step-7: [use Load balancer and access Webapp from outside world]
**Kubernetes have their own load balancer, but if we want to use other load balancer then plugin need for "vanilla kubernetes" but while using "amazon EKS" give
precreated plugin for using aws services like Load balancer(ELB).**
Command for get Load Balancer list:
kubectl get svc

Command for check create load balancer/expose deployment option:
kubectl expose deployment --help
Command for Create LB:
kubectl expose deployment psapp --name pslb --type=LoadBalancer --port 80

After creating load balancer we get "EXTERNAL-IP" that we can use as link on browser:
kubectl get svc
**Kubernetes give us fantastic option that "Scale", by using horizontal Scaling we can scale-out and scale-in our deployment:**
kubectl scale deployment psapp --replicas=4

We can also see on which "node" our pod from CLI:
kubectl get pods -o wide

We can see our Elastic Load balancer "EXTERNAL-IP" to access our psapp(pod/container):
Paste "EXTERNAL-IP" that get from "kubectl get svc" command and we access our psapp through loadBalancer:
- Note:
From below screenshoot we can see that our load balancer work, every time we connect new pod:




### Step-8: [AWS console check]
Now check on aws console our cluster creates: aws Dashbord-->> EKS

EC2 worker node also created:
- Note:
**Here we can see that our instances lanuch at different " availability zones" because we use "nodegroup" while creating Cluster, EKS is very intelligent, every node launch in differnt AZ
because i any AZ goes down then our other AZ our app work:**

Here, for worker node our local laptop Public key is attached because we use "--ssh-access" and i can access Cluster node instance from local machine and manage.
ssh ec2-user@(Public_IP)


- Load Balancer created:

- VPC also created by EKS automatic(VPC give IP range subnet for our node,pod):
- AWS has its own personal plugin called "VPC" that is used for K8S by EKS.
- Every VPC has subnets and every subnet gives IP adress range.

### Step-9: [Delete entire EKS Cluster in one command]
AWS EKS master node all monitoring activity ,If we want delete entire cluster then we use only one following command:
eksctl delete cluster --name pscluster --region ap-south-1
