Elastic Kubernetes Service

Sumit Rasal
6 min readJul 12, 2020

In this post we will deploy EKS service and deploy the WordPress system and store the data in MYSQL database.

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.

Task:

We have to deploy WordPress and MYSQL using EKS service .

  • Create a Kubernetes cluster using AWS EKS.
  • Integrate EKS with EC2, ELB, EBS, EFS.
  • Deploying WordPress & Mysql on top of AWS EKS

Lets Get Started

Step 1. Get your aws login credential and passwords ( key.pem file).

then type following command :-

aws configure

I already filled you should fill all your credentials here.

Step 2. install EKSCTL package from here

https://github.com/weaveworks/eksctl/releases/download/0.23.0/eksctl_Windows_amd64.zip

Extract it and then add to your environment variables.

Step 3. Create Cluster
Create
ClusterConfig.yml
This file will create Cluster on which we are going to deploy wordpress and mysql
In this file we are creating multi node cluster. Here we are creating two node and one master node.

then type following command :-

eksctl create cluster -f ClusterConfig.yml

Cluster has been created

Step 4. Update Config file

aws eks update-kubeconfig — name cluster_name

step 5. Access Cluster

eksctl get cluster

step 6. Create WordPress Deployment
Deploy-wordpress.yml
this WordPress deployment it will create word press .

Use above code to create a WordPress Deployments pod, and mount the PVC,MySQL, secret key and service.

step 7. Create MYSQl Deployment
Deploy-
mysql.yml

Note :- Before going step 9

Launch EFS manually and set same security group to every one.

Copy EFS ID and server url and replace this at FILE_SYSTEM_ID and server.

and then go in your instance and install amazon-efs-utils through terminal this will automatically mount EFS into pods.

step 9. Create Storage Deployment

Storage.yml

This file will give you default storage to install os

step 10. Create Rbac Deployment

Rbac.yml

this file is for security and other things.

step 11. Create Kustomization Deployment

kustomization.yml

this files store your credentials of WordPress and launch all this above files.

then type following command :-

kubectl create -k . (default namespace)

-n eks-cluster (for different namespace)

Following is LoadBlancer Photo

copy your DNS Name and Paste into Browser

Hurray !!

we have created WordPress

AWS FARGATE :-

AWS Fargate is a server less compute engine for containers that works with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS). Fargate makes it easy for you to focus on building your applications. Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design

Fargate allocates the right amount of compute, eliminating the need to choose instances and scale cluster capacity. You only pay for the resources required to run your containers, so there is no over-provisioning and paying for additional servers. Fargate runs each task or pod in its own kernel providing the tasks and pods their own isolated compute environment. This enables your application to have workload isolation and improved security by design. This is why customers such as Vanguard, Accenture, Foursquare, and Ancestry have chosen to run their mission critical applications on Fargate.

create file fargate.yml

it will launch all the necessary nodes so you will get automation in Fargate.

then type following command :-

kubectl create deployment myweb — image=vimal13/apache-webserver-php

kubectl get pods -o wide

kubectl expose deploy myweb — type=LoadBalancer — port=80

then type following command :-

curl 127.0.0.1:given port number at deployment.

HELM :-

The package manager for Kubernetes

Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.

Helm is similar to docker where docker have docker images helm have its charts. you can install charts,update charts and create charts like you do in docker.

i am going to launch database server to show you how to use helem.

step 1. install helm

https://get.helm.sh/helm-v3.3.0-rc.1-windows-amd64.zip

then type following command :-

helm init

# for first time use this to initialize configurations

helm repo add stable https://kubernetes-charts.storage.googleapis.com/

#add charts data base so we can accesses them.

helm repo update

# create new caches refresh repos

helm install — name my-release — set root.password=secretpassword,user.database=app_database bitnami/mysql

# install our first chart

it will create your database server that is MYSQL.

note:-

last two lines are signal command.

Now you can see our data base ready for work.

for removing this use following command: -

helm ls

# to see release-name

helm uninstall release-name

# remove all related to this release

Conclusion:-

With EKS concept we have launched WordPress and MYSQL pods and we have applied all the necessary concepts.

also we have seen bonus fargate and helm concepts for deployment purpose.

“Thanks! to Mr. vimal Daga sir gave great concept of AWS EKS service”

The Task is Collaborate with Venkates Pensalwar .

Thanku For checking Article

--

--

Sumit Rasal

Technology I Know — MLops | Devops | Docker | RHCSA | CEH |