Did your app or server fail due to limited resources on your system ? Did you fail deploying your own cluster in Kubernetes due to lot of management work and limited resources under your Lab?
Well here comes Amazon EKS service to your rescue. Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service and It is one of the most trusted way to run Kubernetes due to its high security, reliability, and scalability.
There are a lot of benefits for using Amazon EKS like Serverless option, Security, Simplified management and many more. You can get more information on AWS EKS service from here.
Now in this blog i will be demonstrating how you can deploy your own Wordpress and MYSQL server database using EKS.
Note :- You can use any frontend and backend service as per your requirement.
There are some requirements mentioned below:
- Some basic knowledge of AWS Cloud Computing.
- Similarly basic knowledge of Kubernetes service along with yml coding.
- Knowledge of how to launch frontend and backend services.
- Some softwares like aws cli, kubectl, eksctl and add paths of all of them to your system environment variables.
- Optional :- Download my repo code from here if you want to follow along with me.
So here are the steps:
Step 1: Head over to your AWS account and create a new AWS IAM User with admin privileges.
Get your Acess Key and Secret Access Key and configure your AWS cli using
Step 2: Create a Cluster file using yml code. You can get some help from here or you can get my repo from earlier and make some changes.
Step 3: Run following command to create a cluster. Cluster formation will take 15–20 min.
eksctl create cluster -f cluster.yml
After Cluster formation you can verify from AWS Console also
Step 4: Run below command to update or create kubectl configuration file which will allow us to contact to our cluster through kubectl command.
aws eks update-kubeconfig --name mycluster
Step 5: Head back to your AWS console and create an EFS file system and attach VPC and Subnets created by our Cluster.
Note: While choosing subnets choose subnet which is used by your nodegroups.
Step 6: Create a namespace for isolated and more control over your work
kubectl config set-context --current --namespace=wordpress-mysql
Now you have to run 3 files which will run and make your EFS provisioned and availaible for cluster and storage.yaml will make make pvc for permanent storage for both Wordpress and MYSQL.
kubectl create -f efs-provisioner.yaml
kubectl create -f rbac.yaml
kubectl create -f storage.yaml
Step 7: Now create a secret which is more secure and enter a password which you would choose and later refer it to in deploy-wordpress.yaml & deploy-mysql.yaml
kubectl create secret generic mysql-pass --from-literal=password=mydb
Step 8: Now the final step is to deploy your MYSQL and Wordpress yaml files.
kubectl create -f deploy-wordpress.yaml
kubectl create -f deploy-mysql.yaml
You can get your Load Balancer IP from
kubectl get all
Then enter your IP in your browser and boom!. There comes your Wordpress setup page, fill them and now you will be landed to your Dashboard.
Feel free to create your WP site by customizing theme or whatever you want to do.
Now the most beautiful part is if you delete this pod, then also a new pod will be created with same data and same public IP.
If you want to delete your cluster use below command
eksctl delete cluster -f cluster.yml
and also delete your EFS system through AWS console.
Github repo: https://github.com/Apeksh742/EKS-Cluster
Thanks all of you for reading. See you in next blog.