Configuring k8s Multi-Node cluster using Ansible

Problem Statement

Solution

Prerequisites

ansible conf file
https://github.com/ansible/ansible/tree/stable-2.9/contrib/inventory
chmod +x ec2.py
chmod 600 Key_Name.pem

Step-1)Creating ec2 role

ansible-galaxy init ec2
tasks/main.yml
vars/main.yml

Note: You can also use Terraform(Iac) for provisioning, it’s the better choice instead of using Ansible for provisioning. I have used Ansible because my problem statement is different 😄.

Step-2)Creating Kubernetes master role

ansible-galaxy init k8s_master
tasks/main.yml
vars/main.yml

Step-3)Creating Kubernetes Slave Role.

ansible-galaxy init k8s_master
tasks/main.yml

Use This Collection

ansible-playbook PLAYBOOK_NAME.yml
ansible-playbook PLAYBOOK_NAME.yml

Output 🚀

playbook output

DevOps/Cloud Enthusiast