??Step-by-step setup Kubernetes Cluster in EC2

??Step-by-step setup Kubernetes Cluster in EC2

Kubeadm Installation Guide :

This guide outlines the steps needed to set up a Kubernetes cluster using kubeadm.

Pre-requisites :

?Ubuntu OS (Xenial or later)

?sudo privileges

?Internet access

?t2.medium instance type or higher

Both Master & Worker Node :

? Run the following commands on both the master and worker nodes to prepare them for kubeadm.


sudo apt update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo apt install docker.io -y

sudo systemctl enable --now docker # enable and start in single command.

# Adding GPG keys.
curl -fsSL "https://packages.cloud.google.com/apt/doc/apt-key.gpg" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kubernetes-archive-keyring.gpg

# Add the repository to the sourcelist.
echo 'deb https://packages.cloud.google.com/apt kubernetes-xenial main' | sudo tee /etc/apt/sources.list.d/kubernetes.list

sudo apt update 
sudo apt install kubeadm=1.20.0-00 kubectl=1.20.0-00 kubelet=1.20.0-00 -y        

?Sample Command run on master node


Master Node:

?Initialize the Kubernetes master node.

sudo kubeadm init        

After successfully running, your Kubernetes control plane will be initialized successfully.

?Set up local kubeconfig (both for root user and normal user):

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config        

?Apply Weave network:

kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml        

?Generate a token for worker nodes to join:

sudo kubeadm token create --print-join-command        

?Expose port 6443 in the Security group for the Worker to connect to Master Node:


Worker Node :

?Run the following commands on the worker node:

sudo kubeadm reset pre-flight checks        

?Paste the join command you got from the master node and append --v=5 at the end. Make sure to use sudo before the command

After succesful join :-


Verify Cluster Connection:

?On Master Node:

kubectl get nodes        


Ishmeet Singh

Frontend Developer?? || Growth expert ?? || Follow-> Devops related content?? || Helping Client's to Grow their Profile and Business?? || Feel Free to connect ??|| DM for Promotion ??

1 年

This is a comprehensive guide, Subhojyoti Das. The step-by-step approach makes it an invaluable resource for anyone diving into Kubernetes. Thank you for sharing your expertise with the community.

Cristian Vargas

Estudiante Cyberseguridad en Siglo 21 AWS Certified Cloud Practitioner / Google Cloud Computing Foundations

1 年

Thanks for Sharing

Thiago Maior

CEO at EZOps Cloud | Leading the future of DevOps with secure and efficient solutions allied with AI-powered innovation

1 年

Great Job!

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

Subhojyoti Das的更多文章

  • Deploying Amazon Prime CloneUsing Jenkins, Terraform, and AWS

    Deploying Amazon Prime CloneUsing Jenkins, Terraform, and AWS

    In this project, we successfully deployed an Amazon Prime Video clone application by leveraging AWS, Jenkins…

    1 条评论
  • ??Getting Started with Microsoft IIS Server

    ??Getting Started with Microsoft IIS Server

    ?What is an IIS server? ?IIS (Internet Information Services) is a web server designed for hosting websites and…

    2 条评论
  • Project 6 - Azure DevOps CI/CD Pipeline Project (AKS)

    Project 6 - Azure DevOps CI/CD Pipeline Project (AKS)

    GitHub Repo -https://github.com/SubhojyotiDas3/2048-game-cicd-project-4 Step 1 - Setup Azure DevOps Now you can go to…

    2 条评论
  • Deep Dive into K9S

    Deep Dive into K9S

    K9s is a terminal-based user interface that provides a real-time view of your Kubernetes cluster. It simplifies…

  • Project 5 - CI-CD pipeline Deployed in Kubernetes

    Project 5 - CI-CD pipeline Deployed in Kubernetes

    Today we will create a CI-CD pipeline using GitHub, Jenkins, Kubernetes, and Docker. Git Repo- https://github.

  • Project 4 - Jenkins CI-CD pipeline using GitHub Webhooks

    Project 4 - Jenkins CI-CD pipeline using GitHub Webhooks

    Today we will create a CI-CD pipeline using GitHub, Jenkins, Ansible and Docker. We will push the code to GitHub, from…

  • ??Setup Apache Web server in AWS EC2 and Host a Simple Static Website

    ??Setup Apache Web server in AWS EC2 and Host a Simple Static Website

    ?What is Apache? ? Apache HTTP Server is a free and open-source web server that delivers web content through the…

    2 条评论
  • ??Terraform for devOps

    ??Terraform for devOps

    ?What is Terraform? ? Terraform is an infrastructure as code (IaC) tool created by HashiCorp, designed to simplify and…

    1 条评论
  • ??Deep Dive into AWS Migration

    ??Deep Dive into AWS Migration

    ?What is AWS Cloud Adoption Framework? ?AWS Cloud Adoption Framework organizes guidance into six areas of focus, called…

  • ??Deep Dive into AWS Pricing & Support

    ??Deep Dive into AWS Pricing & Support

    ?What is AWS Free Tier ? ?The AWS Free Tier enables you to begin using certain services without having to worry about…

社区洞察

其他会员也浏览了