In this article I will try to cover simple installation of K8s on vSphere environment. As i’ve finally started my path to containers world and need some environment to practice. Enjoy reading.
As i’ve mentioned before environment will be quite simple. We will have 1 master node and 2 worker nodes. VMs are based on CentOS 8. As it is a lab environment for practice I didnt pay much attention to the security (i.e. everything is done via root). So if you plan to do it proper way, keep this in mind.
So first of all we need to prepare 3 VMs and configure them. Turn off swap, disable SELinux, disable firewalld and remove podman (in CentOS8 it is replacement for docker) and install docker.
sed -i.bak -r 's/(.+ swap .+)/#\1/' /etc/fstab
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
dnf remove podman -y
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
dnf install docker-ce
systemctl start docker
systemctl enable docker
Add K8s Repo /etc/yum.repos.d/kubernetes.repo
And install required packages
systemctl start kubelet
systemctl enable kubelet
Enable filtering /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
apply sysctl --system
We gonna use flannel as our internal network do not change the subnet use the same one as in here
After installation was done you will get the command with token to add.
We create system variable:
To join worker nodes use the command which was shown on the screen after you deployed master node using kubeadm init:
Copy admin.conf from the master node and export it to system variable:
Now we can test if everything is good and run:
This is basic installation of k8s using kubeadm.
Hope it was helpful for you!