A role to create a Kubernetes Multi Node Cluster - with 1 Master node & mutiple Worker nodes (by default 2, but scalable). The role can be used to setup the cluster on AWS Cloud.
If you already have EC2 instances created (master and worker instances) then you need to manually create the inventory -
[master] IP 1 [worker] IP 2 IP 3
Meaning that 1 IP (of master) should have hostgroup name explicitly setup as "master" and rest IPs should have hostgroup name explicitly setup as "worker".
- If you want to even create the EC2 instances using ansible playbook automatically then you can use this playbook that I have created -
AWS EC2 Instance Playbook
Go through the README.md of this repo for the requirements to run
ec2.yml
file. You will need to specify your AWS Access Key & AWS Secret Key.
This role doesn't require any variable to be specified by the user.
This is a stand alone role, that will work as it is without any dependency on other Galaxy roles.
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: master
gather_facts: no
tasks:
- command: curl http://ipv4.icanhazip.com
register: ip
- debug:
var: ip.stdout
- name: Call the role
include_role:
name: Dakshjain1.Ansible-Galaxy_K8SMultiNodeCluster_Role
vars:
master_ip: "{{ ip.stdout }}"
- hosts: worker
gather_facts: no
tasks:
- command: curl http://ipv4.icanhazip.com
register: ip
- debug:
var: ip.stdout
- name: Call the role
include_role:
name: Dakshjain1.Ansible-Galaxy_K8SMultiNodeCluster_Role
BSD
This Role is created by Daksh Jain. For any queries, suggestions, corrections please contact here:
I am always open to learn from the best minds !! :)