Kubernetes, the hard way, on bare metal with containers and virtual machines (VM)
View the Project on GitHub cloud-helpers/kubernetes-hard-way-bare-metal
This set of documents aims at providing full hands-on guides to set up Kubernetes (aka K8S) clusters on bare metal servers, which can actually be physical servers or virtual machines (VM), on premises or in private and public clouds.
Those documents are adaptations of the excellent “Kubernetes The Hard Way - Bare Metal” guide (by Tobias Schöneberg), itself derived from the famous “Kubernetes The Har Way” guide, by Kelsey Hightower.
Except for the Proxmox host itself, which is based on a Debian distribution, all the nodes are installed with CentOS distributions. Other distributions may of course be used. One distrubtion has to be chosen, so let it be CentOS for these guides.
For the Kubernetes-related tools and binaries (e.g., Docker, Go,
kubectl
), two variants are documented:
The master and worker nodes usually feature different components:
kube-apiserver
,
component on the master that exposes the Kubernetes API. It is the front-end
for the Kubernetes control plane. It is designed to scale horizontally –
that is, it scales by deploying more instances.etcd
,
consistent and highly-available key value store used as Kubernetes’
backing store for all cluster data.kube-scheduler
,kube-controller-manager
,
component on the master that runs controllers. Logically, each controller
is a separate process, but to reduce complexity, they are all compiled
into a single binary and run in a single process. These controllers include:
cloud-controller-manager
,
cloud-controller-manager
runs controllers that interact with
the underlying cloud providers. The cloud-controller-manager binary
is an alpha feature introduced in Kubernetes release 1.6kubelet
,
is an agent that runs on each node in the cluster. It makes sure that
containers are running in a pod.
The kubelet
takes a set of PodSpecs
that are provided through
various mechanisms and ensures that the containers described in those
PodSpecs
are running and healthy. The kubelet
does not manage
containers which were not created by Kubernetes.kube-proxy
enables the Kubernetes service abstraction by maintaining network rules
on the host and performing connection forwardingkube-system
namespace.
As many other documentations, that one will soon be outdated, and imperfect for sure. Contributions are therefore welcome to complemenent that guide. For instance, through issues or pull requests.
Guide to set up a Kubernetes cluster on Proxmox-based KVM/QEMU virtual machines (VM). Using any other virtualization framework than Proxmox should not make much difference.
While full virtualization (with virtual machines) provides more flexibility (e.g., choice of kernel and type of operating system, reserved CPU and memory resources), it implies more overhead than containers. The following section accommodates cases with more resource-conscious requirements.
Guide to set up a Kubernetes cluster on Proxmox-based LXC containers. Using LXD or OpenVZ rather than Proxmox should not make much difference.
While there are quite a few articles and solutions on Kubernetes and similar clusters in Docker containers (e.g., KinD, Footloose), the literature remains scarce about Kubernetes deployed on container technologies such as Linux containers (e.g., LXC, OpenVZ). However, Linux containers allow for far more flexibility than Docker containers. Basically, Linux containers aim at executing full-blown (Linux) operating system (OS), whereas Docker containers aim at micro-services and serverless platforms, mainly servicing single processes.
This guide therefore aims at helping filling the gap of documentation in the Linux container space for Kubernetes.
That section provides some details on how to prepare a Proxmox distribution in order to setup Kubernetes clusters on it.
All the Kubernetes cluster nodes are insulated thanks to a gateway: all the traffic from outside the cluster is channelled through the gateway. The set up of such a gateway is also an addition to this set of guides. It allows one to experiment with Kubernetes clusters, including operating some in production-like settings, while keeping some good level of security.