We will be installing CentOS 7 along with Docker, kubelet, kubeadm and kubectl on all of our 3 hosts.
The CentOS 7 image can be downloaded [here](lsmod | grep br_netfilter).
Once we have CentOS we need to install it on to our VM for lab purpose.
We assume that you have CentOS 7 64-bit installation on all VMs with at least
2 CPUs
2GB of RAM
I think 8GB of Storage will do just fine.
Docker
must be installed
If not, then you can follow this link to install one.
IMPORTANT: swap must be disabled.
If not, then you can follow this link to remove swap.
If you forget this part, kubelet will fail to start.
For this lab, if you freshly install CentOS 7.
You might wanted to also disable firewalld on all nodes. Follow this link to do so.
Reference: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl
We will install these packages on all of your etcd hosts:
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.This part is fairly easy. We do this for all nodes.
sudo cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=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.gpg>
exclude=kubelet kubeadm kubectl
EOF
# Set SELinux in permissive mode (effectively disabling it)
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
sudo systemctl enable --now kubelet
The kubelet is now restarting every few seconds, as it waits in a crashloop for kubeadm to tell it what to do.