Deploying A WordPress Application In Kubernetes Cluster Using Kubeadm Tool In AWS EC2 Instances

May 26, 2022 | Comments(2) |


1. Introduction
2. Deployment Architecture
3. Prerequisites
4. Kubernetes Components Leveraged
5. A Brief Overview of the steps involved
6. Step-by-Step Guide
7. Conclusion
8. About CloudThat
9. FAQs

1. Introduction

In this blog, we will create a Kubernetes multi-node Cluster in a Virtual Machine Instance (EC2) and deploy a WordPress application on top of it.

Here, I am developing a cluster that gives us complete control over the nodes.

2. Deployment Architecture

Kubernetes Architecture

3. Perquisites:

To Deploy a WordPress application in Kubernetes, you will need the following:

  • An AWS account
  • Kubeadm Tool
  • Calico Network plugin
  • Docker

4. Kubernetes Components Leveraged:

  • Deployment
  • Stateful set
  • Services
  • Secrets
  • Volumes
  • 3 EC2 instances: One master node, two worker nodes

5. A brief overview of the steps involved:

  1. Launching three instances
  2. Setup kubeadm cluster
  3. Joining the worker nodes with the master node
  4. Deploying WordPress application

6. Step-by-Step Guide

Step 1: Create three instances of t3.medium running ubuntu 20.14 in the AWS console in any region.

Step 2: Add the security group Kubernetes-related port number and calico port number

Kubeadm tool

Kubeadm tool

Step 3: Tag one Instance as a Master node,

Remaining instances as worker one and worker two nodes.

SSH into the master and worker instance and Run the following commands.





# Restart nodes to load them the br_netfilter and overlay







Step 4: On the Master, node instance, follow the below commands to Initiate the Kubeadm, generate the token and Install Calico network plugin.

#Kubeadm init

#Generate Token

#Install calico networking

Step 5: A file is created in the master node named “nodes-join-token”. Open it and copy the token

Kubeadm tool

Step 6: Past the token in both the worker nodes to join them into the cluster.

Kubeadm tool

Kubeadm tool

Step 7: After the above step, run the below command in the master node to verify whether nodes are joined.

Kubeadm tool

Successfully created Kubernetes Cluster using Kubeadm.

Step 8: SSH into the master node and execute the below code To Download the WordPress application.

#Install GIt

#make a directory

Kubeadm tool

Step 9: Deploy yaml code in a sequence on the master nodes.

Step 9.1: Go to the Kubernetes directory

Step 9.2: Deploy persistent volume for MySQL

Step 9.3: Deploy persistent volume claim for MySQL

Step 9.4: Deploy service for MySQL

Step 9.5: Deploy secrets

Step 9.6: Deploy Deployment of mysql

Step 9.7: Deploy persistent volume for WordPress

Step 9.8: Deploy persistent volume claim for WordPress

Step 9.9: Deploy service for WordPress

Step 9.10: Deploy Deployment of WordPress

Kubeadm tool

Step 10: Access the WordPress application in the browser.

Kubeadm tool

7. Conclusion:

Kubeadm is the right tool to bootstrap the Kubernetes cluster on your virtual machines. Kubeadm sets up a minimal viable cluster. It is designed to have all the components you need in one place in one cluster regardless of where you are running them. An advantage of kubeadm is that it can be used anywhere —even Raspberry Pi— to set up a cluster and try it out before committing to something like kops

8. About CloudThat

CloudThat is the official AWS Advanced Consulting Partner, Microsoft Gold Partner, and Google Cloud Partner, helping people develop knowledge on the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Feel free to drop a comment or any queries that you have regarding AWS services, Kubernetes Engine, or consulting requirements and we will get back to you quickly. To get started, go through our Expert Advisory page and Managed Services Package that is CloudThat’s offerings.

9. FAQs:

  1. What is the difference between minikube and kubeadm?

ANS: Both are Designed for testing, research, and learning. Minikube is a fast and straightforward solution for deploying a single-node Kubernetes cluster, but it is not a minimum viable solution and production-ready cluster. According to Kubeadm, it is a minimum viable and production-ready cluster and allows us to choose the runtime environment, although it has a docker by default.

  1. Why is it needed to disable the memory swapping while installing the Kubernetes cluster?

ANS: It is highly necessary to disable memory swap before creating a kubeadm cluster. Because the scheduler in Kubernetes chooses the best node to deploy the newly provisioned resources like pods. If the swapping is allowed that leads to stability and performance issues in the Kubernetes cluster.

2 Responses to “Deploying A WordPress Application In Kubernetes Cluster Using Kubeadm Tool In AWS EC2 Instances”

Leave a Reply