Kubernetes Installation
Install Kubernetes 1.18.6 on ubuntu 20.04 LTS
Install Docker
apt-get update
apt-get install docker
systemctl enable --now docker
Install Kubernetes Component
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet=1.18.8-00 kubeadm=1.18.8-00 kubectl=1.18.8-00
Disable SWAP on System
swapoff --all && sed -i '/^.*swap.*/ d' /etc/fstab
Initialize Kubernetes
kubeadm init --kubernetes-version 1.18.6
Test Kubernetes Initialize
kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods
Using Calico as CNI
wget https://docs.projectcalico.org/v3.14/manifests/calico.yaml
sed -i 's/3.14.2/3.14.1/' calico.yaml
kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f calico.yaml
echo 'source <(kubectl completion bash)' >> ~/.bashrc
source ~/.bashrc
mkdir -p ~/.kube
cp /etc/kubernetes/admin.conf ~/.kube/config
kubectl edit node <node name> # To find node name use #kubectl get node -o name
# Remove following line under specs: section
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
For Automatic Installation
curl -sS https://itmconsult.ir/kubernetes/installation/kubernetes_installation.sh | sudo bash
Last updated on 12 Nov 2020
Published on 12 Nov 2020