📌 CREATE A MULTI-CLOUD SETUP of K8S cluster:

Kubernetes Master Node

yum install docker -ysystemctl start –now dockercat <<EOF> /etc/docker/daemon.json
{"exec-opts": ["native.cgroupdriver=systemd"]}EOFsystmctl docker restartcat <<EOF> /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.gpgEOFyum install kubeadm kubectl kubelet -ysystemctl enable kubelet –nowkubeadm config images pullyum install iproute-tccat <<EOF> /etc/sysctl.f/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1EOFkubeadm init --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=NumCPU --ignore-preflight-errors=Memmkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/configkubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.ymlkubeadm token create --print-join-command

Kubernetes Slave-1 over GCP

yum install iproute-tcsudo yum remove docker docker-common docker-selinux docker-engine-selinux docker-engine docker-cecat <<EOF> /etc/yum.repos.d/docker-ce.repo[docker-ce-stable]
name=Docker CE Stable
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
EOFyum install docker-ce –nobest -yy
systemctl start --now dockercat <<EOF> /etc/docker/daemon.json
{ "exec-opts": ["native.cgroupdriver=systemd"]}
EOFsystemctl restart dockercat <<EOF > /etc/yum.repos.d/kubernetes.repo[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
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
EOFyum repolist -vyum install kubeadm kubectl kubelet -y
systemctl enable kubelet --nowcat <<EOF> /etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOFsysctl –system
echo 1 > /proc/sys/net/ipv4/ip_forwardLast command is the token that we copied form the master

Kubernetes Slave-2 over Azure

yum install iproute-tcsudo yum remove docker docker-common docker-selinux docker-engine-selinux docker-engine docker-cecat <<EOF> /etc/yum.repos.d/docker-ce.repo[docker-ce-stable]
name=Docker CE Stable
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
EOFyum install docker-ce –nobest -yy
systemctl start --now dockercat <<EOF> /etc/docker/daemon.json
{ "exec-opts": ["native.cgroupdriver=systemd"]}
EOFsystemctl restart dockercat <<EOF > /etc/yum.repos.d/kubernetes.repo[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
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
EOFyum repolist -vyum install kubeadm kubectl kubelet -y
systemctl enable kubelet --nowcat <<EOF> /etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
Last command is the token that we copied form the master

Kubernetes Slave-3 over local system RHEL8

yum install iproute-tcsudo yum remove docker docker-common docker-selinux docker-engine-selinux docker-engine docker-cecat <<EOF> /etc/yum.repos.d/docker-ce.repo[docker-ce-stable]
name=Docker CE Stable
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
EOFyum install docker-ce –nobest -yy
systemctl start --now dockercat <<EOF> /etc/docker/daemon.json
{ "exec-opts": ["native.cgroupdriver=systemd"]}
EOFsystemctl restart dockercat <<EOF > /etc/yum.repos.d/kubernetes.repo[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
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
EOFyum repolist -vyum install kubeadm kubectl kubelet -y
systemctl enable kubelet --nowcat <<EOF> /etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOFsysctl –systemswapoff -aLast command is the token that we copied form the master
kubectl get nodes

TASK COMPLETED!!!

--

--

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