The second part of this blog post series deals with the preparation of the Kubernetes and service nodes.
It describes the installation of the HAProxy, the Flannel daemon (flanneld), the docker engine (docker) and kubelet.
Installing the service node
The service node which is located outside the cluster undertakes the task of a load balancer.
Since the open source version of nginx does not support TCP load balancing we use HAProxy.
HAProxy distributes packages between the hosts on the transport layer of the OSI reference model.
The following configuration is set up after the Installation of HAProxy.
After restarting the service it should be possible to reach the master nodes via the load balancer URL (e.g. loadbalancer.example.com) although at this time there is no service available on port 443.
Flanneld
Flannel enables the cluster wide distribution of the pods’ packages.
Since the description of the networks are stored in etcd a connection of all Kubernetes nodes (master and worker) to the etcd cluster has to be enabled.
The docker daemon on each Kubernetes node will be performed with special parameters provided by flanneld.
Cross-node communication of containers is realized by iptables that route the packages to the correct target servers.
For this purpose flanneld creates its own virtual network interface and must therefore run with root rights.
Create etcd client certificates
Kubernetes nodes need a client certificate because each user of the etcd cluster has to authenticate.
It can be created as described in the first part of this blog post series but there are differences in the openssl.cnf.
The openssl.cnf has a simpler structure as flanneld has to identify itself as client only.
This certificate request is also signed with the root CA stored as /etc/ssl/etcd/etcd-client.crt on the Kubernetes nodes.
Altogether, the following files should be available on all Kubernetes nodes:
Installing of the daemon
For the various settings an extra file options.env is used.
Besides all etcd nodes options.env file contains the certificates.
Finally, the Systemd service is created.
Docker engine
As you can see in /etc/systemd/system/flanneld.service the script mk-docker-opts.sh creates environment variables with the file /run/flanneld/docker_opts.env.
These variables are used by the Docker daemon.
We use the drop-in feature of Systemd.
So there is no need to change the standard service definition of Docker.
The installation of the Docker engine is done in the standard way.
drop-in overwrites the start command.
The new one contains the variables from the file /run/flanneld/docker_opts.env generated by the flanneld and loaded via the option EnvironmentFile.
Kubelet
Kubelet controls the directory /etc/kubernetes/manifests and creates Docker containers from the Pod definitions located here.
Therefore, it also needs root rights.
The Kubelet version has to be compatible to the one of the API server.
Installation
Kubelet is part of the official Kubernetes release.
It is simply loaded to every Kubernetes node and unpacked there.
In addition we have to add Kernel boot parameter.
Refer to the following code example on how to do this using sed.
Summary
The external service node is used as a load balancer.
Working on the Transport layer of the OSI reference model it does not terminate SSL but simply routes the traffic.
On all Kubernetes nodes run various services.
Flanneld is required to run the Docker engine.
It stores data for the networks in the etcd cluster and therefore needs a client certificate.
The Docker engine is a standard installation.
It uses its own drop-in to be able to handle the parameters provided by flanneld.
Karsten Peskova is a qualified civil engineer and has held a variety of different jobs since joining the software industry many years ago. He enjoys working directly with our customers, but also solving technical problems of all kinds.
Our website uses cookies to improve your user experience. Some cookies are
required for the basic functionality of the website while other cookies help
us to improve our content and layout. You can agree to all cookies by selecting
"Accept all" or you can select "Accept required" to confirm only the required ones.
Further information can be found in our
Data protection declaration.