ITGOIT - Wiki

Install requirements

  1. Kubernetes requires a container runtime, so the first step is to install Docker on your Ubuntu server. You can do this by running the following command:
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -sSL https://get.docker.com/ | CHANNEL=stable bash

This command uses the official Docker installation script to install Docker. This script automatically detects the OS and version of your system and installs the appropriate version of Docker.

Install Kubernetes

  1. Install kubeadm, kubectl, and kubelet: These are the three core components of Kubernetes, and they can be installed by running the following command:
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
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
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
  1. Initialize the cluster: Once you have installed the core components, you can initialize the cluster by running the following command:
sudo kubeadm init

This command creates the necessary resources and sets up the master node.

  1. Configure the kubectl: After the initialization is complete, you will need to configure the kubectl command-line tool to connect to the cluster. You can do this by running the following command:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config