Make sure that you are selecting any ubuntu image with version >= Ubuntu Server 20.04 LTS (HVM)
Luanch one server and install the ansible & git as below
apt-get update -y
apt-get upgrade -y
apt-add-repository ppa:ansible/ansible
apt-get update
apt-get install ansible -y
root@ip-172-31-16-231:~# ansible --version
ansible 2.9.27
Note: Make sure that your ansible version is latest
yum install epel-release ansible -y
sudo amazon-linux-extras install epel -y
sudo yum install ansible -y
git clone https://github.com/shan5a6/kubernetes-installation.git
cd kubernetes-installation
Update the pem key to file "mykey.pem"
chmod 600 mykey.pem
update the hosts file with neccessary hosts information
Note: Take only private dns
[kubernetes-master-nodes]
ip-172-31-29-161.ec2.internal ansible_user=ubuntu os_type="Ubuntu"
[kubernetes-worker-nodes]
ip-172-31-20-9.ec2.internal ansible_user=ubuntu os_type="Ubuntu"
ansible-playbook settingup_kubernetes_cluster.yml
ansible-playbook join_kubernetes_workers_nodes.yml
ansible-playbook clear_k8s_setup.yml