Installation 3 Node kubernetes cluster

Installation 3 Node Kubernetes Cluster

SHORT INTRODUCTION

There are many ways to build a Kubernetes cluster. One of them is using a tool called adam. Kubeadm is the official tool for “Getting Started” when building your first Kubernetes cluster. With the ease of getting up and running, I wanted to put together this quick guide to installing the Kubernetes cluster using theadm! 

At First, We Have 3 centOS machine

Master:- 192.168.33.11

Worker1:-192.168.33.12

Worker2:- 192.168.33.13

All These machine are able to ping each other .

And swap memory of all these machine should be off.

Install docker on all VMs
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add repo
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install docker
$sudo yum install docker -y
Start docker and enable it.
$ systemctl start docker
$ systemctl enable docker

Now Install the Kubectl commands on all VMs

cat < /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubeletkubeadmkubectl
EOF
Stop Selinux

setenforce0

$ sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
Install Kubeletkubeadmand kubectl On all Vms
$ sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
Now enable kubectl
$ sudo systemctl enable --now kubelet
ON MASTER ONLY :-
$sudo kubeadminit --pod-network-cidr=10.217.0.0/16 --apiserver-advertise-address=
$sudo kubectl create -f
https://raw.githubusercontent.com/cilium/cilium/v1.6/install/kubernetes/quick-install.yaml

To start using your cluster, you need to run the following as a regular user:

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

Now copy The token and connect the worker by kubeadm join command

$kubeadm join 192.168.33.11:6443 --token eu2xe7.6yl6jzcesos4yhxc \
--discovery-token-ca-cert-hash sha256:92c27ab61c84f12ebb389f45f309d2b1749e090cb9d55b857ae0e96d6673b5ed
$ sudo echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables

Run kubectl get nodes on master ,it takes  time to ready

$sudo kubectl get nodes
$ sudo systemctl start docker
$ sudo systemctl enable docker

Tags:

No responses yet

Leave a Reply

Your email address will not be published.

Latest Comments

No comments to show.