ARTH_TASK 19
The Aim of this Article is to setup Multi-Node Kubernetes Cluster upon AWS Cloud using Ansible Playbooks uploading these Ansible Playbooks as Ansible Roles upon Ansible Galaxy open-source platform.
To perform this setup I have these platforms:
⚜️RHEL8 VM running inside Oracle Virtual Box → Ansible Master Node
⚜️AWS Instances → Ansible Worker Nodes
⚜️Inside our Ansible Master Workspace We have lots of files:
🔹ansible.cfg: This is local ansible configuration file
🔹inventory.txt: This file is the database for our ansible playbook, it contains all the ip address where automation has to be performed.
🔹password.yml: This is variable file of playbook where my aws credentials are stored so that aws can authenticate this Ansible program
🔹pod_ip.yml: This variable file contains pod cidr network information i.e. our cluster resources will get ip from this ip network range
🔹ec2.yml: This is the playbook that will launch three instances inside my aws cloud account with these specifications.
aws_access_key & aws_secret _key variables will fetch my access & secret key from the password.yml file which i have specified in variables_file section.
🔰Let’s Run this ec2.yml playbook
Playbook has been successfully executed without any errors, let’s check our aws portal to confirm whether instances has been launched or not.
That’s Great our playbook executed successfully and deployed instances on aws cloud…
Let’s move further…
🔹K8.yml: This file configure our Kubernetes master server, this playbook:
- Installing docker as underlying container engine and iproute-tc package(required for master configuration),Starting docker services
- Setting up Kubeadm Repo & installing kubeadm, kubectl, kubelet package
- pulling up the required container images for the cluster setup
- updating docker driver from cgroup to systemd & Starting up kubelet services
- Initialising Cluster with Kubeadm , along with our network ip range & ignoring pre-flight errors of less computing resources (CPU, ram)
- setting up kubernetes config file so that kubectl command knows our master ip ,port username
- Setting up Flannel container so that we can setup VXLAN inside our Kubernetes Cluster
- Generating user token from master so that worker nodes can join in & storing this token inside a file
🔰Let’s Run this K8.yml playbook
Our second playbook too executed successfully……
Let’s move further…
🔹workernode.yml: This file configure our Kubernetes master server, this playbook:
- Installing docker as underlying container engine and iproute-tc package(required for master configuration),Starting docker services
- Setting up Kubeadm Repo & installing kubeadm, kubectl, kubelet package
- pulling up the required container images for the cluster setup
- updating docker driver from cgroup to systemd & Starting up kubelet services
- Running the token command in shell prompt so that worker nodes can join with master & form kubernetes cluster
🔰Let’s Run this workernode.yml playbook
That’s Great all the playbooks executed successfully…
Let’s move further…