Configure K8 cluster using Ansible

Configure K8 cluster using Ansible

Hello guys,

Here I came up with a new article in this article I configure the Kubernetes cluster using Ansible and created the cluster of Kubernetes.

So let me tell you what is Kubernetes First


Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.

It groups containers that make up an application into logical units for easy management and discovery. Kubernetes builds upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.

No alt text provided for this image


Planet Scale

Designed on the same principles that allows Google to run billions of containers a week, Kubernetes can scale without increasing your ops team.



Never Outgrow

Whether testing locally or running a global enterprise, Kubernetes flexibility grows with you to deliver your applications consistently and easily no matter how complex your need is.



Run K8s Anywhere

Kubernetes is open source giving you the freedom to take advantage of on-premises, hybrid, or public cloud infrastructure, letting you effortlessly move workloads to where it matters to you.

For more information visit the site below.



Now let's move to the task


Task Description :-


?? Ansible Role to Configure K8S Multi Node Cluster over AWS Cloud.

?? Create Ansible Playbook to launch 3 AWS EC2 Instance

?? Create Ansible Playbook to configure Docker over those instances.

?? Create Playbook to configure K8S Master, K8S Worker Nodes on the above created EC2 Instances using kubeadm.

?? Convert Playbook into roles and Upload those role on your Ansible Galaxy.

?? Also Upload all the YAML code over your GitHub Repository.

?? Create a README.md document using markdown language describing your Task in creative manner.

?? Create blog about task and share on your LinkedIN profile.


Lets Begin:-



Step 1:- Creating configuration file for ec2 configuration

No alt text provided for this image
No alt text provided for this image


Step 2:- Configuration file of Ansible

No alt text provided for this image

Step 3:- Creating Roles for master and slave

# ansible-galaxy init master
# ansible-galaxy init slave


Step 4:- configure file for master

No alt text provided for this image
No alt text provided for this image


Step 5:- Configuring slave

No alt text provided for this image
No alt text provided for this image


Step 6:- Now let's run the ec2 conf file to check whether we get the master and slave or not.

# ansible-playbook playbook name


No alt text provided for this image

It's working lets check-in GUI

No alt text provided for this image


Step 7:- Now lets run the Kubernetes configuration on master and slave

No alt text provided for this image


Let's log in to the master and check whether Kubernetes configure or not?

No alt text provided for this image
# Kubctl get node
# kubeclt get pods -n kube-system



No alt text provided for this image

It's working lets create a deployment


Step 9:- create deployment

# Kubectl create deployment <name> <imagename>


No alt text provided for this image


So it works hope you like it ??

Any suggestion regarding this please DM me.

Thank you!!!??????



要查看或添加评论,请登录

Ritesh Chaudhari的更多文章

社区洞察

其他会员也浏览了