Skip to content

Provides Ansible playbook to setup a K8s Cluster (1 Manager and N workers) on AWS

Notifications You must be signed in to change notification settings

iamsidshetty/k8s-cluster-setup-using-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Kubernetes Cluster Setup in Public Cloud Using Ansible Playbooks

Provides Ansible playbook to setup a K8s Cluster (1 Manager and N workers)

Ansible Setup

Installation

Installation guide for various OS

Ansible Documentation

Ansible documentation is located here

AWS Setup

We will setup a 3 node cluster with 1 Manager and 2 Worker nodes.

Ensure the Manager node has atleast 2 vCPU and 4 GiB RAM

Recommended AWS Instances:

AWS AMI: Ubuntu Server 18.04 LTS (HVM), SSD Volume Type

Manager Nodes: t2.large

Worker Nodes: t2.micro

Steps to run Ansible Playbook for setting Cluster in AWS

Ansible playbook is located in aws folder

Add the AWS instances IPs and ssh key path to aws-hosts file

Run the following commands:

# check the ansible playbook syntax
ansible-playbook --syntax-check kubernetes-cluster-1M-2W.yaml -i aws-hosts

# run the playbook
ansible-playbook kubernetes-cluster-1M-2W.yaml -i aws-hosts

The join command for worker nodes to join the master node is in the cluster-join.txt file created by kubeadm init command and is located in the home directory of your Master node

Future Enhancements

  1. Use ansible variables to pass the join command from Manager to Worker Nodes. This will eliminate the need for user to manually run the join command after kubeadm init
  2. Enhance/add playbooks for other public cloud providers - GCP, Azure and OCI

License

MIT