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)
Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.
k8s provides rollouts and rollbacks in a very easy way by using strategy Deployment. If anyone goes wrong u just need to rollback
if a container fails, k8s automatically retry multiple times, because k8s, behind the scene, monitor the containers 👊.
In an easy way, u can create replicas of existing pods, without any issue.
k8s provides 3 main services, cluster IP, Nodeport, and Loadbalancer 💡. Cluster IP is just for the private one, if u want to make your pod accessible…
✅ 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.😉.
RUN dnf install python36 -y
RUN dnf install net-tools vim which -y
docker build -t IMAGE_NAME .
docker run -it --name NAME_OF_CONTAINER IMAGE_NAME
Tech Enthusiast, zeal for learning, and explore the new technologies, loves to do automation in today’s Agile world.