Installing K8s Component - Prabhueswaran/K8s GitHub Wiki

Installing kubeadm, kubelet and kubectl

Debian Based Distribution

swapoff -a

  • Update the apt package index and install packages needed to use the Kubernetes apt repository:

sudo apt-get update

sudo apt-get install -y apt-transport-https ca-certificates curl

  • Download the Google Cloud public signing key:

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

  • Add the Kubernetes apt repository:

echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

  • Update apt package index, install kubelet, kubeadm and kubectl, and pin their version:

sudo apt-get update

sudo apt-get install -y kubelet kubeadm kubectl

sudo apt-mark hold kubelet kubeadm kubectl

sudo systemctl enable kubectl

Configuring a cgroup driver

Runtime - Docker

  • On each of your nodes, install the Docker for your Linux distribution as per Install Docker Engine.

  • Configure the Docker daemon, in particular to use systemd for the management of the container’s cgroups.

sudo mkdir /etc/docker

If already exist run the below command

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
  • Restart Docker and enable on boot:

sudo systemctl enable docker

sudo systemctl daemon-reload

sudo systemctl restart docker