Task: Automate Kubernetes Cluster Using Ansible.
🔅 Launch ec2-instances on AWS Cloud eg. for master and slave.
🔅 Create roles that will configure master node and slave node seperately.
🔅 Launch a wordpress and mysql database connected to it in the respective slaves.
🔅 Expose the wordpress pod and client able hit the wordpress ip with its respective port.
For the above task to be completed we should know few things about Kubernetes, Mysql and wordpress.
What is Kubernetes?
Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
The name Kubernetes originates from Greek, meaning helmsman or pilot. Google open-sourced the Kubernetes project in 2014. Kubernetes combines over 15 years of Google’s experience running production workloads at scale with best-of-breed ideas and practices from the community.
a. AWS Account for EC2 Instances
b. Ansible Controller Node
c. Basics About K8s Cluster and Yaml
So let’s get right into the Task:
♦STEP1: Provisioning the EC2 Instances with K8s Cluster setup.
♦STEP2: Creating mysql.yml which will be later applied.
♦STEP3: Creating mywp.yml for Wordpress pod which will be later applied.
♦STEP4: Creating service.yml for Exposing wordpress pod which will be later applied.
♦STEP5: Creating main task file which will run every command of kubernetes according to our requirement.
♦STEP6: Running the task file using Ansible to configure the Cluster setup.
♦STEP7: Go To Browser and type the Public Ip of the pod where we just launched the “mywp”
♦STEP8: Finally just do the setup and will land to the login page
Thank You guys..Hope you all learned Something
With these 8 easy steps you can configure the whole setup.
If facing any problem please contact me: