Launched Multi-Tier Architecture on AWS EKS Cluster
Apurv Waghmare
6k+ & Growing Linkedin Family|| DevOps Specialist at Amdocs || Docker || Kubernetes || 1X AWS || 2X Azure || Ansible || Terraform || Jenkins ||SAFe 6 certified
What is AWS EKS?
Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service. Customers such as Intel, Snap, Intuit, GoDaddy, and Autodesk trust EKS to run their most sensitive and mission critical applications because of its security, reliability, and scalability.
How can we deploy K8S cluster on EKS?
There are two ways to deploy our kubernetes cluster on top of EKS.
1) Fargate Service of AWS: This gives us server less Kubernetes cluster, server less doesn't mean they don't have servers, it is dynamic in nature, hence created only when it's required.
2) EKS Cluster: Using the power of EKS Sevice which stand for Elastic Kubernetes Service.
How to create EKS Cluster?
Step1: Create EKS cluster and configure the kubeclt command for the launched cluster
We can create this in any region.
Let's create multi-tier architecture.
For creating this we will use the normal kubernetes yml deployment files. What so ever we do with the normal Kubernetes command will be done on the AWS cloud.
So we will create multi tier architecture of Joomla and MySQL, For this we need persistent storage which we will get from EFS. Now, why EFS and not EBS? Because EBS can't be updated for all and at once. In EFS we get and edge over it to have common storage where if updated once it's updated for all.
Step1: Create EKS cluster and configure the kubeclt command for the launched cluster
# eksctl create cluster -f cluster1.yml
# aws eks update-kubeconfig --name mycluster1
You will see your EFS is created and then you will get the details below which we will need to make files.
Necessary installation in the nodes
Before moving further we need to install some program inside the nodes for having support for EFS. This software is amazon-efs-utils. So we need to install it in every node using yum install amazon-efs-utils
Step2: Install Amazon EFS Utilities on every node in the cluster using following command:
# yum install amazon-efs-utils
Step 3: Create namespace for the task.
# kubectl create namespace webns1
Step 4: In create-efs-provisioner file, replace the FILE_SYSTEM_ID at line no. 22 and replace the nfs server at line no. 33 with the values of your EFS file system
Step 5: Create the EFS Provisioner, Role and Storage Class in the webns1 namespace using following commands:
# kubectl create -f create-efs-provisioner.yaml -n webns1
# kubectl create -f create-rbac.yaml -n webns1
# kubectl create -f create-storage.yaml -n webns1
Step 6: Run the kustomization.yaml file to setup the environment and deploy the Joomla to the EKS. Run the following command:
Here we will first create secret box which will create password which we want for MySql and Joomla.
Then we will tell the sequence in which we want the execution of the files.
Finally we will run the Kustomization file.
We will run this command in the directory where we have the Kustomization and all other files.
# kubectl create -k .
This will first storage class which will take storage form EFS which we created. Then PVC for MySql and Joomla then deployment for MySql.
After that we will create a service only for Joomla deployment as we don't want outside people to connect to the database.
Then we will create Joomla deployment.
Step 7: Now our Joomla site is deployed to the EKS and can be accessed using the EXTERNAL-IP provided by joomla service.
# kubectl get all
Finally : open the EXTERNAL-IP provided by the service/joomla
#Deploying Grafana & Prometheus Over EKS Cluster.
What is Prometheus?
Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company. To emphasize this, and to clarify the project's governance structure, Prometheus joined the Cloud Native Computing Foundation in 2016 as the second hosted project, after Kubernetes.
Now we have many use cases where we want to deploy it over container engine and the best way to manage this is using Kubernetes. .
What is Grafana?
Grafana is open source visualization and analytics software. It allows you to query, visualize, alert on, and explore your metrics no matter where they are stored. In plain English, it provides you with tools to turn your time-series database (TSDB) data into beautiful graphs and visualizations.
# Create deployment for prometheus and grafana
1 ) #kubectl create deployment promtest1 --image=prom/prometheus:latest
deployment.apps/promtest created
2) kubectl create deployment graphtest1 --image=grafana/grafana:latest
deployment.apps/graphtest created
# To see the pods
3) kubectl get pods
NAME READY STATUS RESTARTS AGE
graphtest-6755f69597-d582d 1/1 Running 0 11s
mypod1 1/1 Terminating 0 27h
promtest-5569bb7967-dn58w 1/1 Running 0 76s
4) Need to expose these
#kubectl expose deployment promtest1 --type=LoadBalancer --port=9090
service/promtest exposed
#kubectl expose deployment graphtest1 --type=LoadBalancer --port=3000
service/graphtest exposed
5) #kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
graphtest-6755f69597-d582d 1/1 Running 0 118s 10.10.2.4 node02 <none> <none>
mypod1 1/1 Terminating 0 27h 10.10.1.2 node01 <none> <none>
promtest-5569bb7967-dn58w 1/1 Running 0 3m3s 10.10.2.3 node02 <none> <none>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/graphtest LoadBalancer 10.104.83.142 <pending> 3000:32633/TCP 92s
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 27m
service/promtest LoadBalancer 10.96.67.98 <pending> 9090:30187/TCP 111s
NOTE: note : use # kubectl get po -o wide
check on which node graphna and prommo running then to access this use ip of node 01, node02 and expose port number
https://13.234.239.40:30187/ --> promo
https://13.233.38.212:32633/ --> graphna
Thank you to read this article
Git hub link : https://github.com/apurvwagh/-Joomla-on-EKS-AWS-.git
Regards,
Apurv Waghmare
6k+ & Growing Linkedin Family|| DevOps Specialist at Amdocs || Docker || Kubernetes || 1X AWS || 2X Azure || Ansible || Terraform || Jenkins ||SAFe 6 certified
4 年Thanks Amit
CKA || 1xAWS || 4xGCP || 1xAzure || 2xRedHat Certified || DevOps Engineer [???????]@Searce Inc || Freelancer || Terraform || Ansible || GitLab || Jenkins || Kubernetes || Docker || Openshift || AWS || GCP || Azure
4 年Great ?????? Apurv Waghmare