DEV Community

Cover image for How to Install & Setup K8-Cluster using kubeadm
Eze Sugar 👩‍💻
Eze Sugar 👩‍💻

Posted on

How to Install & Setup K8-Cluster using kubeadm

UPDATE & SYSTEM APPICATION IN MASTER AND WORKER NODES
sudo apt-get update && sudo apt-get upgrade

INSTALL DOCKER IN SLAVE & MASTER

sudo apt install docker.io -y
sudo chmod 666 /var/run/docker.sock
Enter fullscreen mode Exit fullscreen mode

INSTALL PACKAGES FOR MASTER & SLAVES

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
sudo mkdir -p -m 755 /etc/apt/keyrings
Enter fullscreen mode Exit fullscreen mode

ADD KUBERNETES REPO AND CPG KEYS IN BOTH MASTER AND WORKER NODES

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
Enter fullscreen mode Exit fullscreen mode

UPDATE PACKAGES IN ALL THE NODES

sudo apt update
Enter fullscreen mode Exit fullscreen mode

INSTALL COMPONENTS IN ALL THE NODES

 sudo apt install -y kubeadm=1.28.1-1.1 kubelet=1.28.1-1.1 kubectl=1.28.1-1.1
Enter fullscreen mode Exit fullscreen mode

INITIALIZE THE MASTER NODE | NB: ONLY ON MASTER

sudo kubeadm init --pod-network-cidr=10.244.0.0/16
Enter fullscreen mode Exit fullscreen mode

CONFIGURE KUBERNETES CLUSER | NB: ONLY ON MASTER

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

DEPLOY CALICO |A NETWOKING SOLUTION | NB: ONLY ON MASTER

kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
Enter fullscreen mode Exit fullscreen mode

DEPLOY INGRESS CONTROLLER | NB: ONLY ON MASTER

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.49.0/deploy/static/provider/baremetal/deploy.yaml
Enter fullscreen mode Exit fullscreen mode

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay