(2 votes, average: 3.00 out of 5)
Loading...
Installing a 3 node(master) Kubernetes cluster on CentOS 7.5
Below I am going to show you how install, configure a 3 node multi-master Kubernetes 1.11 Cluster without using kubeadm, in addition I will also show you how to install/configure 2 worker nodes. While there are many places describing the Kubernetes installation process, they mostly use the kubeadm utility. which is not officially support for a multi-master configuration. in the next few articles, I will be showing you how to configure a Kubernetes cluster manually without using the kubeadm utility. Note: With the recent Kubernetes version(s) it is possible to install a multi-master cluster by using the kubeadm utility, however its still in beta and requires a few workarounds to make it work. With that said, lets jump right in.- Part 1: Initial setup – bear-metal installation, configuration
- Part 2: Installing the Kubernetes VM’s
- Part 3: Installing and configuring Flanneld, CNI plugin and Docker
- Part 4: Installing and configuring kubernetes manifest and kubelet service
- Part 5: Adding CoreDNS as part of the Kubernetes cluster
- Part 6: Adding / Configuring Kubernetes worker nodes
- Part 7: Enabling / Configuring RBAC, TLS Node bootstrapping
- Part 8: Installing / Configuring Helm, Prometheus, Alertmanager, Grafana and Elasticsearch
OS Installation / Configuration
To make it easier to understand the Kubernetes configuration, lets start first with a the Hostname / IP Address digram described below. Hostname / IP Address diagram used in the below configuration All the examples below use.- Oracle VirtualBox to virtualize the Master and Worker nodes.
- CentOS(1804) as the Ber-Metal and Kubernetes VM’s.
cat /etc/yum.conf ... # The proxy server - proxy server:port number proxy=http://yourproxy_ip_:1234 # The account details for yum connections #proxy_username=yum-user #proxy_password=qwerty cat /etc/environment HTTP_PROXY="http://yourproxy_ip_:1234/" HTTPS_PROXY="https://yourproxy_ip_:1234/" ftp_proxy="ftp://yourproxy_ip_:1234/" no_proxy=.domain.com,127.0.0.1,localhost,kmaster1,kmaster1.domain.com,kmaster2,kmaster2.domain.com,kmaster3,kmaster3.domain.com,172.20.0.12,172.20.0.11,172.20.0.13Tip: For our configuration we do not need the Gnome desktop, If you would like to install the Gnome Desktop Just run the below.
yum -y groups install "GNOME Desktop" # Set Gnome Desktop as default (after next reboot). systemctl set-default graphical.target # Enable/start the Gnome Desktop in the current env with a reboot, run systemctl isolate graphical.target # Get current settings systemctl get-default
Installing / Preparing Oracle VirtualBox for Kubernetes
Since I would like to use the most recent VirtualBox I will be downloading it directory from Oracle i.e using Oracles repo. To install Oracle VirtualBox, just run the below.cd /etc/yum.conf wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repoNext, lets install a few VirtualBox pre-requisites. Run all the below.
yum groupinstall "Development Tools" yum install kernel-devel yum update rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum --enablerepo=epel install dkms yum install gcc make patch dkms qt libgomp yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-develOnce completed, reboot the server. Next, install virtualbox by running the below.
yum install VirtualBox-5.2 /usr/lib/virtualbox/vboxdrv.sh setup systemctl enable vboxdrv systemctl start vboxdrv usermod -a -G vboxusers user_name
Configuring VirtualBox networking to be used by Kubernetes VM’s
For Kubernetes master’s to work properly, communicated with each other we need to create/configure a VirtualBox managed network. Just follow the below steps to do so. Note: The steps below are only required for VirtualBox so that the Kubernetes hosts can communicate properly with each other. in a bear-metal configuration a similar configuration would be required on your regular switches. Virtual Box host network manager Virtual Box preferences > network Virtual Box preferences > NAT Virtual Box preferences > Port-forward (3 masters and 3 nodes) Virtual Box VM > Network To access any of the VirtualBox VM’s you can just ssh with the -p option, for example to access the first VM on port 2011, use the below.ssh localhost -p 2011In Part 2 will continue installing / configuring the Kubernetes VM’s and etcd. You might also like – Other related articles to Docker and Kubernetes / micro-service. Like what you’re reading? please provide feedback, any feedback is appreciated.
0
0
votes
Article Rating
Thank you for the time of writing this guide.
I got set up in the first step for networking, but On the following settings steps, starting with Virtual Box preferences > network, it is not clear where and how to get there. While I can open the individual settings for each VM, I cannot get the same result in global for all as you illustrated.
Could you please elaborate further here?
Thank you
1) Click on File – the top left side. 2) Then click on preferences, then network. 3) Next, in the VirtualBox network section, click on the top right green + button (but tool-tip would say – Add new NAT network) 4) Double click on the new network (default name would say NatNetwork). replace name with KubSW1, Network CIDR with 172.20.0.0/23 (as shown above). alternative you can also click the bottom right button (with gear picture) to get the edit menu. 4) Then, click on Port Forward, create/ add all port forward rules shown in the picture above. I hope this… Read more »
Hi, and welcome to my blog.
I am currently away from a computer, I will provide a step by step first thing in the morning.
Hello Eli,
Thank you for these great tutorials. Could you please share what is the default gateway you have assigned to the virtual machines when configuring the external ip address ?
Thank you
Giorgos
Hi Giorgos, and welcome to my blog.
In my experience with VirtualBox it will usually use .2 as the default gateway.
In my example that would mean 172.20.0.2. however I am not sure your specific network configuration might be different if modified from the default, in fact most networks will use .1 as the default gateway.
Now to access the VM you would use ssh localhost -p 2011 (if port 2011 is forward to 172.20.0.2 =>22).
I hope this helps,
Thanks,
Eli
Hello Eli,
Thanks for your great article. There are some points not clear to me. I wish you I could access the details about network config file for each machine. I guess you set IP static for each machine, However I am not successful to ping external network. Can you share your setting at least for one machine (I mean ifcfg-eth0 config file). Thanks!
Hi and welcome to my blog. Unfortunately I don’t have the VirtualBox configuration up at this time. I have a CoreOS physical cluster up and running, but the network configuration can/will be quite a bit different. However, I can still try to help you and get you going, a couple of questions. Just making sure, when you refer to each machine, you mean each VM? What VirtualBox network configuration are you using, like NAT, etc? What networks are configured in VirtualBox under File > Host network manager? What do you see in netstat -rn? Under Preferences > Network > NAT… Read more »
You are awesome! Thanks for fast reply. My mistake, I have missed a small part.
VirtualBox 5.2 wasnt found. Execute this step before installing it.
sudo wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -P /etc/yum.repos.d
Hi Sanrio and welcome to my blog.
Apologize for the issue you have. This post was written when virtualbox 5.2.x was the curent version.
Since the curent version is 6.x. please try yum install VirtualBox-6 or yum install VirtualBox-6.0.
P.s. you can also do a yum search VirtualBox. try to look what is the curent avalble version.
Thanks.
Eli