curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service"| sed "s:/usr/bin:${DOWNLOAD_DIR}:g"| sudo tee /etc/systemd/system/kubelet.service
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf"| sed "s:/usr/bin:${DOWNLOAD_DIR}:g"| sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
echo"Enabling kubelet service..."
sudo systemctl enable --now kubelet
echo"Verify kubeadm version..."
kubeadm version
echo"Downloading and setup docker, containerd and tools..."
sudo swapoff -a
wget https://sh.osa.cubetiqs.com/docker-setup.sh
bash docker-setup.sh
sudo systemctl start docker
sudo systemctl enable docker
echo"Enabling docker daemon for cgroup driver with systemd"
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
echo"Installing socat and conntrack for kubernetes cluster..."
sudo apt-get -y install socat conntrack
echo"Install nfs client tools..."
sudo apt install nfs-common -y
echo"Setting up containerd and configuration..."
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# Setup required sysctl params, these persist across reboots. (If using crio)
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables =1
net.ipv4.ip_forward =1
net.bridge.bridge-nf-call-ip6tables =1
EOF
# Apply sysctl params without reboot
sudo sysctl --system
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
sudo systemctl restart containerd
echo"Create directory and config in $HOME/.kube"
mkdir -p $HOME/.kube
touch $HOME/.kube/config
sudo chown $(id -u):$(id -g)$HOME/.kube/config
chmod o-r $HOME/.kube/config
chmod g-r $HOME/.kube/config
echo"Finished installation for kubectl, kubeadm and kubelet and some required tools, and now you do cluster :)!"