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
Learn More:
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 😅.
https://github.com/ansible/ansible/tree/stable-2.9/contrib/inventory
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.
FROM ubuntu:latest
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
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]
Tech Enthusiast, zeal for learning, and explore the new technologies, loves to do automation in today’s Agile world.