Ansible Role to Configure K8S Multi Node Cluster over AWS Cloud

Hello Friends ,Hope you guys doing absolutely well !😃

In Today’s article, we will create an Ansible role to set up a K8S cluster with multiple nodes in the AWS cloud.

kubernetes

Why you need Kubernetes and what it can do

Containers are a good way to bundle and run your applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if a container goes down, another container needs to start. Wouldn’t it be easier if this behavior was handled by a system?

  1. Storage orchestration
  2. Automated rollouts and rollbacks
  3. Automatic bin packing
  4. Self-healing
  5. Secret and configuration management

K8S Multi Multi-Node Cluster

Ansible

Ansible Roles

Configure K8S Multi Node Cluster over AWS Cloud

Let’s Started ..

1. Launching 3 AWS EC2 Instance with Ansible role

Create Role:

ansible-galaxy init ec2

In tasks file of ec2 role :

In vars file of ec2 role :

2. Setting Up Master Node and Worker Nodes

For Master/Controller Node,

Create role for configuring a Master :

ansible-galaxy init k8s-master

In tasks file of k8s-master role :

In vars file of k8s-master role :

For Worker Nodes,

Create role for configuring a Worker:

ansible-galaxy init k8s-worker

In tasks file of k8s-worker role :

In vars file of k8s-worker role :

In playbook setup.yml :

ansible-playbook setup.yml
kubectl get nodes

🔰Keep Learning❗❗ 🔰Keep Sharing❗❗

Arth Learner — LinuxWorld Informatics Pvt Ltd