Installing, Configuring Kubernetes Cluster On CentOS 7.5 – Adding / Configuring Kubernetes Worker Nodes – Part 6

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Installing, configuring 3 node Kubernetes(master) cluster on CentOS 7.5 – Adding Kubernetes worker nodes to the Kubernetes cluster

Below I am continuing with the Kubernetes cluster setup.
In this post we are going to add / configure worker nodes.

Please check out the full series to see how to configure a 3 node Kubernetes master, the links are below.

This is Part 6 – Adding / Configuring Kubernetes worker nodes.

Preparing Kubernetes worker nodes

Below is a quick re-cape of the Hostname / IP Address I am using for the Master and Worker Nodes.

First we need to preparing the Worker Node (or VM), similar to a the Master node. but, with a few exceptions.

Configure each VM with the below resources.

  1. 1 Virtual CPU is fine.
  2. At least 2Gb of RAM.
  3. At least 12Gb HDD.
  4. Assign Network Switch to network port.

Set the below on each Kubernetes VM (master and Workers).
Disable SE Linux by Running the below.

Disable swap

If you are behind a firewall or corporate proxy, add your proxy to /etc/yum.conf and /etc/environment (for an example check out in part 1).

Install Docker packages

Add kubernetes repo

Install kubernetes and other related packages

Since we are not going to use kubeadm for our configuration comment out all entry’s in /etc/systemd/system/kubelet.service.d/10-kubeadm.conf like the below example.

Disable the system firewall by running the below, it would be partially managed by kubernetes.

Note: There are other options to deal with firewall rules, for example just enabling the ports required by kubernetes.

Lastly before continuing reboot each vm instances.

Note: etcd shuld NOT be configured on the worker node, however /etc/kubernetes/ssl shuld be copied to every worker node.

Worker Node Flannel configuration

Tip: Similar to Master Nodes, you need to configure flannel, however the flannel service dose not depend on etcd since there is no local etcd service on a worker node.
The first thing we are going to do, is grab the latest flanneld binary, you do so by running something like the below.

Note: For a list of the latest flanneld versions click here.

Make sure vXlan is enabled on your system, by running the below.
Note: Flannel uses vXlan as the encapsulation protocol.

Next, lets create the flanneld service
cat /usr/lib/systemd/system/flanneld.service

Next, modify /etc/sysconfig/flanneld something like the below (change ip address for each worker node).

Flannel CNI configuration

We are now going to add the CNI configuration.
First lets Download the latest CNI drivers, you do so by running the below.

Note: You can find the latest CNI releases here.

Next, lets create the CNI configuration directory

Create the the CNI network configuration file.

We are now ready to start flannel, you do so by running the below.

Configuring the docker service(s).

Replace in /usr/lib/systemd/system/docker.service service like the below.

Create a docker socket service file.

Create a docker network file /etc/docker/daemon.json with the below content (replace with the ip of each node).
Note: Example below is taken from node1.

Now lets start the docker service.

Creating the kubernets worker manifest

A Kubernetes Worker Node only consists of a proxy components(process) something like the below proxy yaml config.

  1. Kube Proxy

Now, lets create the Kubernetes proxy manifest file.

just create the below file in the /etc/kubernetes/manifests/ directory.
Note: Replace –hostname-override with each work node IP address.
cat manifests/kube-proxy-work.yaml

Create your kubeconfig.yaml – (your authentication method).

Create the config.yaml file. this file is contains additional kubelet configuration.

Finally, create your kubelet service file.

Create the kubelet directory

We are finnaly ready to start the kubelet service.

To verify your pods runing/wokring run the below.
If all is working properly, you should see something like the below output.

To test the worker nodes using the Nginx application, using the below nginx.yaml file.

Just run the below to create the nginx pods.

Verify nginx deployment, output shuld be simlar to below.

Test the Nginx application by runing curl agenst one of the pod ip address.

This concludes the series of CentOS Kubernetes Master and Worker Nodes setup.

In the next post Part 7 I am going to show you how to enable RBAC in your Kubernetes cluster as well as Node bootstraping.

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.

Leave a Reply

avatar
  Subscribe  
Notify of