You will install following packages on all of your machines:
- kubeadm: the command to bootstrap the cluster.
- kubelet: the component that runs on all of the machines in your cluster and does things like starting pods and containers.
- kubectl: the command line util to talk to your cluster.
Here is the referred document from Kubernetes:
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
- 2.1 Install kubeadm, kubelet and kubectl on CentOS / Redhat
Step 1: Set Kubernetes repo
$ update-alternatives --set iptables /usr/sbin/iptables-legacy`` $ cat /etc/yum.repos.d/kubernetes.repo[kubernetes] name=Kubernetes baseurl=[https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64](https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64) enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpgStep 2: Set SELinux in permissive mode (effectively disabling it)
$ sudo setence 0 $ sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/configNote: Setting SELinux in permissive mode by running setenforce 0 and sed … effectively disables it. This is required to allow containers to access the host filesystem, which is needed by pod networks for example. You have to do this until SELinux support is improved in the kubelet.
Some users on RHEL/CentOS 7 have reported issues with traffic being routed incorrectly due to iptables being bypassed. You should ensure net.bridge.bridge-nf-call-iptables is set to 1 in your sysctl config, e.g.
$ cat /etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-iptables = 1
$ sudo sysctl --systemMake sure that the br_netfilter module is loaded before this step. This can be done by running
$ lsmod | grep br_netfilterStep 3: Install Kubernetes
$ sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes` $ sudo systemctl enable --now kubelet- 2.2 Install kubeadm, kubelet and kubectl on Ubuntu
Step 1: Set kubernetes repo
$ sudo apt-get update $ sudo apt-get install -y iptables arptables ebtableStep 2: Install Kubernetes
$ sudo apt-get update && sudo apt-get install -y apt-transport-https curl $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - $ sudo apt-get update $ sudo apt-get install -y kubelet kubeadm kubectl $ sudo apt-mark hold kubelet kubeadm kubectlNote: If you want to install specified version of kubelet, kubeadm and kubectl. You can use following command to check and install available versions.
For Redhat:
$ sudo yum install -y kubelet-1.22.2 kubeadm-1.22.2 kubectl-1.22.2 --disableexcludes=kubernetes $ sudo systemctl enable --now kubeletFor Ubuntu:
$ sudo apt-cache policy kubeadm $ sudo apt-get install -y kubelet=1.22.2-00 kubeadm=1.22.2-00 kubectl=1.22.2-00 $ sudo apt-mark hold kubelet kubeadm kubectl