AWS-EKS Cluster
Amazon Elastic Kubernetes Services (EKS) runs Kubernetes control plane instances across multiple Availability Zones to ensure high availability. Amazon EKS automatically detects and replaces unhealthy control plane instances, and it provides automated version upgrades and patching for them. Kubernetes is open-source software that allows you to deploy and manage containerized applications at scale. Kubernetes manages clusters of Amazon EC2 compute instances and runs containers on those instances with processes for deployment, maintenance, and scaling. Using Kubernetes, you can run any type of containerized applications using the same toolset on-premises and in the cloud.
To get started with Amazon EKS:
- First, create an Amazon EKS cluster in the AWS Management Console or with the AWS CLI or one of the AWS SDKs.
- Then, launch worker nodes that register with the Amazon EKS cluster. We provide you with an AWS CloudFormation template that automatically configures your nodes.
- When your cluster is ready, you can configure your favourite Kubernetes tools (such as kubectl) to communicate with your cluster.
- Deploy and manage applications on your Amazon EKS cluster the same way that you would with any other Kubernetes environment.
To Deploy WordPress and MySQL on EKS Cluster:
Requirements:
- Create an IAM user with administrative power and then configure it with AWS CLI with that particular user.
- Install kubectl, eksctl in your system.
Now following these steps.
Step 1: Setting up the Cluster:
To setup Kubernetes cluster using amazon EKS service, we can write a yml extension code for creating a cluster with the number of instances we require right now.
After saving the yml file in a folder, we'll make the cluster by running the following command in the command prompt:
eksctl create cluster -f cluster.yml
Step 2: Configuring kubectl for our EKS service
kubectl is a command-line tool which lets us control Kubernetes clusters. So to configure it for the cluster we made on AWS EC2 instances
aws eks update-kubeconfig --name d2zclusters
Step 3: Installing amazon EFS services on all the instances
yum install -y amazon-efs-utils
Step 4: Creating EFS-provisioner and EFS file system
First, we have to create a security group of the VPC we've created. After creating the security group, we'll create our EFS file system. After creating our EFS file system, we'll copy the DNS name and then will configure our EFS provisioner with the DNS name we copied!
In server, we've to copy the DNS name just like shown in this image!
This is a yaml extension file which we'll use to create our EFS provisioned. To create EFS provisioner, we've to run this command:
kubectl create -f create-efs-provisioner.yaml
Step 5: Creating an RBAC role
kubectl create -f create-rbac.yaml
Step 6: Creating Storage
kubectl create -f create-storage.yaml
Step 7: Creating WordPress and MySQL deploying files
Either we can deploy this here by using the similar command or we can use another concept of Kubernetes known as Kustomization.
This is our MySQL file.
This is our WordPress file.
Step 8: Creating the Kustomization file
This is the Kustomization file which helps us customize Kubernetes objects. This will run both of deploy-mysql.yaml and deploy-wordpress.yaml files in one go.
kubectl create -k .
Now check the pods:
With this, our Cluster is deployed.
Now test the sysre
So, we've finally deployed WordPress site of our own using AWS-EKS service where we learnt how to integrate EKS with EC2 and EFS services.
Well done keep up the good work 👍
Great work!
That looks wonderful! Great job :)