DevTech101

DevTech101
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.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. Note: Get going in minutes with a full Kubernetes cluster by using the free Kubernetes generator on my GitHub repository. Version 0.7 just became available of the Kubernetes generator, supporting kubernetes version v.1.13.x+, RBAC, Auto Bootstraping, and more. You can generate your own configuration in minutes by using the generator, available on my GitHub repository by going here, you can also just use the ready examples files available here https://github.com/elik1001/coreos-kubernetes-generator/tree/master/examples This is Part 1 – Installing and configuring kubernetes – Initial setup – bear-metal installation, configuration.

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.
  1. Oracle VirtualBox to virtualize the Master and Worker nodes.
  2. CentOS(1804) as the Ber-Metal and Kubernetes VM’s.
The first steps is to Download a CentOS image. In my case I used CentOS 7.5 Minimal(CentOS-7-x86_64-Minimal-1804.iso), install that on your bare-metal server. Note: If you are behind a corporate firewall or proxy, set the below in /etc/environment and in /etc/yum.conf.
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.13
Tip: 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.repo
Next, 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-devel
Once 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 2011
In 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
Subscribe
Notify of
guest
10 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Andrew
Andrew
November 5, 2018 3:29 pm

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

Giorgos Nakos
Giorgos Nakos
March 27, 2019 3:52 am

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

camer
camer
April 2, 2019 5:17 am

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!

camer
camer
April 3, 2019 4:21 am
Reply to  Eli Kleinman

You are awesome! Thanks for fast reply. My mistake, I have missed a small part.

Sanrio
Sanrio
August 14, 2019 2:30 pm

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

10
0
Would love your thoughts, please comment.x
()
x
%d bloggers like this: