Launch Multi Node Cluster In Amazon EKS
What Is Kubernetes?
Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem.
What is Amazon EKS?
Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed kubernetes service.
Why Amazon Eks?
EKS is a best place to run kubernetes. because Aws launch masternode and also launch worker/slave node using ec2 instance. We can integrate aws services (ELB, EBS, EFS, etc) with our kubernets cluster. Aws also provide high availability.
We can connect with Eks through Webui, Aws cli , eksctl.
Eksctl is a simple CLI tool for creating clusters on EKS.
Amazon EKS feature-
Managed Kubernetes Cluser, Managed control plane, Managed worker nodes, Load balancing, Serverless Compute & Logging etc.
Our objective for this task-
1- Create a Eks cluster through eksctl on Aws.
2- Integrate Eks with EC2,ELB,EBS
3- Deploying Joomla and MySql on Aws Eks.
Let’s Start our task-
Prerequisite for this task
1-Install Aws cli on your base system.
2-Setup eksctl on your base system.
3- Login with your aws account in cli mode through your secret and access key
4- Setup kubectl command into your base system.
1-Create a Eks cluster through eksctl on Aws.
Now create a yml file for cluster.
In above code we create two node group. through this code three worker/slave node will launch two with t2.micro instance type and one with t2.small instance type.
now run this command eksctl create cluster -f filename.yml
after running above command output
you can check through command
To see the cluster = eksctl get cluster
To see node group = eksctl get nodegroup cluster clustername
you can also check from webui
Now our cluster is created.
to use this cluster we need config file for getting config file we use this command aws eks update-kubeconfig name clustername
now we can use our kubenets cluster using kubectl command.
Now we will deploy our Mysql & Joomla pod and attach PVC (persistent volume claim) through EBS.
What is PVC?
When we deploy our pod they use emphermal storage if the pod restart, deleted our data will be delete and we can’t retrieve to save data persistently we use pvc. if we are using persistent volume at that time if pod deleted but the data will be save we can deploy pod again and attach that pvc through pod and use our data.
Now Create a yml file to deploy your Mysql pod
Create one more yml file to deploy Joomla pod.
Now we will create a Kustomization file by using this file we can launch mysql & and joomla within a single command.
Now run the command kubectl create -k .
after run the above command output
Now check your pod and service has been created or not
To check pod = kubectl get pods
To check service = kubectl get service
To check storageclass = kubectl get sc
To check pvc = kubectl get pvc
Now our pod is ready we create a load balancer to connect out client.because our pod is in isolated environment. load balancer provide us a public dns . copy and paste it on your browser and output
Now our webapp is ready you can use it.
Thanks for reading..
Thanks to Vimal Sir to providing such type of knowledge.