Geek Culture
Published in

Geek Culture

Created by Akanksha

Automation — WordPress Deployment on Kubernetes Multi-Node Cluster launched over AWS using Ansible

Deploying website using WordPress is an easy task but when it comes to high availability and Fast Deployment with Orchestration and Auto-Provisioning facility — We are referring MNA over Cloud….

Kubernetes :

Kubernetes is an Orchestration Tool that monitor and manage the Containers. It was designed by Google in 2014 and is a Open-Source tool. Kubernetes is established for deployment, maintenance and scaling of containers to maintain a particular state and provide Continuous support to the environment by various features that include Pods, Labels, Selectors, Controller, Replication Controller, Deployment Controller, Replica Set and Services. Kubernetes uses declarative approach for Orchestration hence uses declarative language i.e. YAML or ….. (Refer my Previous Blog on Kubernetes)

Ansible :

Automation is there in the world of IT from decades but Ansible is mainly designed for “Configuration Management”, the tool come to market with High Scalability and ability to kick Start the business, without giving high wages to employees and just Making Scripts to keep on configuring each node started by the Load Balancers. Now the question arises what all Ansible is providing as automation, Can we rely on it for all the Steps of Configuration Management ?……(Refer my Previous Blog on Ansible)


AWS (Amazon Web Services) provide a great level of services due to which it is the most preferred public cloud in world. According to recent Gartner report AWS Rank 1st in the World of Providing Resources and Services with greatest Availability and Security. AWS provides a set of fully managed services that you can use to build and run serverless applications. Serverless applications don’t require provisioning, maintaining, and administering servers for backend components such as compute, databases, storage, stream processing, message queueing, and more….(Refer my blog on AWS)


WordPress (WP) is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database. It is incredibly flexible, with thousands of themes, plugins, and support option for website development to know more about WordPress visit!!

Let’s Brief our Plan before Proceeding further:

  1. In totality we have four EC2 instances here and one Local System which is a controller node (*RHEL OS at base OS) from where we will run the roles to setup everything just in one click.
  2. The instances are to be provisioned by “EC2 role”
  3. Mater Node Setup is next task that would take place by running “K8s_master”
  4. Slave nodes Setup and Registration with master is the next part that would deploy and get provisioned using “K8s_slave”
  5. Next the NFS-Server would launch for providing Directories.
  6. Then a kube_wordpress role for Wordpress pod setup and PVC claim.
  7. Lastly Setup file for running all the roles.
# mkdir kube-ansible
# cd kube-ansible
# mkdir roles
# vim ansible.cfg
file format:
secret_key: huadub7635897^%&hdfqt57gvhg


# mkdir role
# cd role
# ansible-galaxy init ec2
# ansible-galaxy init k8s_master
# ansible-galaxy init k8s_slave
# ansible-galaxy init k8s_client
# ansible-galaxy init nfs-server
NFS-Server Setup
# cd role/nfs-server/tasks
# vim main.yml
# cd role/nfs-server/vars
# vim main.yml
# cd role/ec2/tasks
# vim main.yml
# cd role/ec2/vars
# vim main.yml
# cd role/k8s_master/tasks
# vim main.yml
# cd role/k8s_master/vars
# vim main.yml
# cd role/k8s_slave/tasks
# vim main.yml
# cd role/k8s_master/vars
# vim main.yml
# cd role/kube_wordpress/tasks
# vim main.yml
# cd role/k8s_master/vars
# vim storage.yml.j2
# cd role/kube_wordpress/files
# vim kustomization.yml
# vim mysql-deploy.yml
# vim secret.yml
# vim wordpress-deploy.yml
# cd kube_ansible/
# vim setup.yml
# ansible-playbook setup.yml -ask-vault-pass

Thanks for reading. Hope this blog have given you some valuable inputs!!



A new tech publication by Start it up (

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akanksha Singh

Platform Engineer | Kubernetes | Docker | Terraform | Helm | AWS | Azure | Groovy | Jenkins | Git, GitHub | Sonar | NMAP and other Scan and Monitoring tool