Home > All Posts > devops > 2021 January, 09 >
1 min read
Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation.
Why Multi-Nodes? Because it is much faster and available than Single Node for Production to end-user, that's why we are going to setup multi-nodes.
Before that, you must start to download minikube for k8s and Vmbox and Redhat image, setup add and install RedHat or Centos OS to vmbox named Main. Let's start open vmbox and start the Main OS.
1yum install net-tools vim iproute-tc -y
Kubernetes require in docker package so create file named docker.repo in 3 Nodes and start edit
1vim /etc/yum.repos.d/docker.repo
Make sure edit it below for download and install docker file to your pc
1[docker]2baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/3gpgcheck=0
To install docker ce for free and enable and start always running in docker
1yum install docker-ce -y --nobest2sytemctl start docker3sytemctl enable docker
lets install k8s
1cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo2[kubernetes]3name=Kubernetes4baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch5enabled=16gpgcheck=17repo_gpgcheck=18gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg9exclude=kubelet kubeadm kubectl10EOF1112# Set SELinux in permissive mode (effectively disabling it)13sudo setenforce 014sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config1516sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
Make Sure Clone Main to add more two nodes named node1 and node2 in vmbox and must regenerate different networks in different images. we need to add a name in host instead of IP address
Main in vm
1hostnamectl set-hostname main2exec bash
node1 in vm
1hostnamectl set-hostname node12exec bash
node2 in vm
1hostnamectl set-hostname node22exec bash
set up Local DNS Name server
1vim /etc/hosts
edit in hosts like this
1192.168.43.35 main2192.168.43.151 node13192.168.43.156 node2
same thing in node1 and node2 VM's
It is easier to transfer to another machine node1 in VM's
1scp /etc/hosts 192.168.43.151:/etc/hosts
node2 in VM's
1scp /etc/hosts 192.168.43.156:/etc/hosts
Now, Create kubeadm ( main )
1kubeadm init --pod-networks=10.10.1.0/16
add config in main os
1mkdir -p $HOME/.kube2sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config3sudo chown $(id -u):$(id -g) $HOME/.kube/config
now join node1 and node2 to main
1kubeadm join 192.168.43.35:6443 --token 1z41ua.pd2l2pl5df286hcb --discovery-token-ca-cert-hash sha256:4547a1aacde3bd0b1ff37fe27619aa858081634717b212e609dfeba96e0402be
Related Posts