??Step-by-step setup Kubernetes Cluster in EC2
Subhojyoti Das
DevOps Engineer || AWS Certified Cloud Practitioner || Docker || Kubernetes || Container CI-CD || Terraform || Linux || AWS || Jenkins || Git & Github || Electrical Engineer || Wildlife Photographer ||
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
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.
Estudiante Cyberseguridad en Siglo 21 AWS Certified Cloud Practitioner / Google Cloud Computing Foundations
1 年Thanks for Sharing
CEO at EZOps Cloud | Leading the future of DevOps with secure and efficient solutions allied with AI-powered innovation
1 年Great Job!