For solving this issue I am showing two methods, the first is manually and the second is Automation, btw I prefer automation 😁.
docker pull centos
docker run --net=host -it --name c1 centos
ansible-galaxy collection install rootritesh.k8s_cluster
Ansible Roles to Configure K8S Multi-Node Cluster over AWS Cloud.
For this problem statement, I am using the Ansible collection, in this ansible collection I am creating 3 roles, one for ec2, the second for Kubernetes master, third for Kubernetes slave 🙂.
For this Problem Statement, we need two OS 😅.
chmod 600 Key_Name.pem
First, we need to delete all the IP addresses from all the OS routing tables. after that add the System A Ip in System B and System C routing table, at last, add the System B and System C Ip in System A routing table. huh, that’s simple 😅.
route del -net 192.168.0.0(IP_ADDRESS) gw 192.168.0.1(GATEWAY) netmask 255.255.255.0(NETMASK) enp0s3(NIC Card)
✅ Docker Installed.
First, we need to make one playbook for updating inventory, for this, I have jinja 😅 in Playbook, After that use hosts name for configuring the web server in the docker container.
RUN apt update && apt install openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test
RUN echo "test:test"| chpasswd
RUN service ssh start
RUN echo "test ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
✅ You Need One VM(Virtual Machine) (Here I am using Redhat VM in VirtualBox)that has internet connectivity.
✅ Here we need to add the Rule in our OS.😉.
Tech Enthusiast, zeal for learning, and explore the new technologies, loves to do automation in today’s Agile world.