Skip to content

Latest commit

 

History

History
85 lines (61 loc) · 1.94 KB

kube-prereqs.md

File metadata and controls

85 lines (61 loc) · 1.94 KB

Configure the Kubernetes & Docker Repositories on ALL Nodes

Feel free to swap Docker with another CRI (Container Runtime Interface) e.g. CRI-O, containerd

sudo apt update && sudo apt install -y apt-transport-https curl ca-certificates software-properties-common
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo add-apt-repository \
  "deb https://apt.kubernetes.io/ kubernetes-xenial main"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update

Disable Swap

sudo swapoff -a && sudo sed -i '/ swap / s/^/#/' /etc/fstab

The /etc/fstab file should now be commented out for the swap mount point

Install and Hold the Docker packages

sudo apt-get update && sudo apt-get install -y \
docker-ce=18.06.2~ce~3-0~ubuntu

sudo apt-mark hold docker-ce=18.06.2~ce~3-0~ubuntu 

Modify Docker to use systemd and overlay2 storage drivers

cat > /etc/docker/daemon.json <<EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF

sudo mkdir -p /etc/systemd/system/docker.service.d

Restart docker

sudo systemctl daemon-reload && sudo systemctl restart docker

Install and Hold Kubernetes Packages (V1.15.11)

sudo apt install -y kubelet=1.15.11-00 kubeadm=1.15.11-00 kubectl=1.15.11-00 && sudo apt-mark hold kubelet=1.15.11-00 kubeadm=1.15.11-00 kubectl=1.15.11-00

Enable & Start Kubelet (if not already started)

sudo systemctl enable kubelet && sudo systemctl start kubelet

Modify /etc/hosts

We want to make sure that the /etc/hosts does not resolve the hostname to 127.0.0.1, if it does, comment it out.