Creating multi-node and multi-cloud Kubernetes cluster

Kubernetes:

Amazon Web Service :

Microsoft Azure

yum install docker -y
systemctl start docker
systemctl enable docker
vim /etc/docker/daemon.json{
"exec-opts": ["native.cgroupdriver=systemd"]
}
systmctl docker restart
vim /etc/yum.repos.d/k8s.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
yum install kubeadm kubectl kubelet -y
systemctl enable kubelet --now
kubeadm config  images pull
yum install iproute-tc
vim /etc/sysctl.f/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
kubeadm init --control-plane-endpoint "PUBLICIP:PORT" --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=NumCPU --ignore-preflight-errors=Mem

pod-network-cidr= IP range for pods inside the slave nodes

Control plane endpoint = assign the cluster with a public IP with port

ignore-preflight-errors= Ignoring the unwanted CPU errors and memory errors

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Generating Token:

kubeadm token  create  --print-join-command

Slaves Configuration:

yum install iproute-tc    #Installing iproute-tcyum install docker -y  #Install Dockervim /etc/docker/daemon.json     #Changing the driver{
"exec-opts": ["native.cgroupdriver=systemd"]
}
systemctl restart docker #Restart docker
systemctl enable docker --now #enable Docker
#Kubernetes Repository
vim /etc/yum.repos.d/k8s.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
#Installing the required packages
yum install kubeadm kubectl kubelet -y
#Enabling kubelet service
systemctl enable kubelet --now
#Configure the iptables /etc/sysctl.d/k8s.confvim /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
sysctl --system
swapoff -a
kubeadm token create --print-join-command
kubectl get nodes

⭐Keep Learning !! Keep Sharing !!⭐

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store