Step 0: architecture and components
- Complete redesign of the Kubernetes on-premise cookbook, with AI as a design assistant.
- Technical choices: kubeadm, Rocky Linux, XCP-ng, Cilium, Longhorn, Traefik.
- Introduction to Kubernetes and cluster composition (control planes, LAN/DMZ/GPU workers).
- Cookbook menu and project structure.
Introduction
IT and technologies are constantly evolving. It's time for me to review my Kubernetes cookbook to offer a new version of the associated articles and display a new architecture.
My goal remains the same, which is to provide an end-to-end installation guide for a Kubernetes platform.
This new version will reuse elements from the previous version while sometimes making more or less significant changes depending on the topics covered.
We are still using an industrialization approach, seeking to automate as many actions as possible, but always with a good understanding of what we are doing and why we are doing it.
Integrating AI and deployment on XCP-ng
One of the new features is the integration of AI for assistance in design and implementation.
Today, it would be absurd not to try to optimize your work using AI. We shouldn't hide from this; we should embrace it and, above all, do it correctly.
AI has also pushed me to rethink my original architecture and change some of the choices I made back then: not because they were bad or unsuitable, but mainly because I can now afford to do things that I probably wouldn't have attempted at the time, and that have become feasible thanks to AI.
My thinking and assistance are done with Claude; it is currently the AI service I use most often, either through the web interface or via Claude Code.
My goal is not to let AI do everything, but to use it as an additional source of expertise that I can rely on.
Another of my goals is to demonstrate how XCP-ng and the French Vates ecosystem, on which my lab now runs, can be used to deploy a complete Kubernetes platform.
Cookbook menu and target architecture
Here is the menu for this new cookbook. The links will be updated as I publish the articles.
- Step 0: Description of the architecture and components: This step describes the target architecture and provides some details about certain building blocks and technical choices.
- Step 1: Packer template: Preparing the VM template to serve as a base for deploying all other servers. This is an opportunity to introduce the Packer tool, which was not used in the previous cookbook.
- Step 2: Terraform deployment: Deploying all VMs via Terraform according to the Infrastructure As Code logic.
- Step 3: Presentation of the Ansible logic chosen and the initial configuration elements regarding the operating system and basic best practices.
- Step 4: Deployment of the necessary base configuration via Ansible. This is also an opportunity to set up the network and system prerequisites for the K8S cluster.
- Step 5: Setting up HAproxy and Keepalived with VRRP support for high availability.
- Step 6: Discovering kube-vip and its role in initializing the cluster
- Step 7: Role for initializing the cluster and the principles behind kubeadm
- Step 8: Role for adding nodes to the cluster
- Step 9: Role for deploying the CNI Cilium and network principles under K8S
- Step 10: Deployment of the CSI (Container Storage Interface): NFS & SMB to provide shared persistent volumes.
- Step 11: Deployment of the Longhorn storage solution for block storage intended for exclusive access.
- Step 12: Deployment of the Seaweed FS storage solution for object storage.
- Step 13: Deployment of CNPG for simplified PostgreSQL database creation.
- Step 14: Adding a physical node to the cluster to take advantage of GPU resources via NVIDIA operators.
Each step will be an opportunity to go into more detail about the associated technical building blocks. Some points will reuse elements from the previous cookbook, others will be completely reworked.
The old cookbook will remain online if needed.
The ultimate goal is to have a fully operational Kubernetes cluster that can run various workloads with a minimal level of redundancy, suitable for use in a production environment.
Here is the diagram of the chosen architecture.
Click the image to enlarge.
Structure and logic chosen for the AI assistant
To design this cookbook and in line with what I explained earlier about AI, here's the logic applied for assistance using Claude Code.
Anthropic's coding assistant uses various configuration files to better define the requested task.
The main file to place at the root of your projects is the CLAUDE.md file. It summarizes the overall objective and provides general instructions. I have described my project in this file, along with any associated constraints.
In the subdirectory docs, there are three other Markdown files.
- ARCHITECTURE.md: This document describes the architecture to be implemented. At this level, I provide details about the hardware and IP configurations of the servers that will be used, along with the major architectural choices.
- CONVENTIONS.md: This covers naming conventions and standards to follow. It is very important in a project like this to adopt a consistent naming scheme, especially for files describing K8S objects.
- ROADMAP.md: This file defines the project roadmap, which essentially outlines the steps presented earlier. It allows me to track the progress of the project in sync with Claude Code.
Next, I have three other directories, each of which contains a CLAUDE.md file:
- xkub.coolcorp.priv.packer: This directory is dedicated to Packer. I put all the files related to the solution here, and these files are used to deploy the reference VM that serves as a template for my Linux operating systems, including the K8S nodes.
- xkub.coolcorp.priv.iac: This directory is dedicated to Terraform. I store all the files related to the solution for deploying the cluster servers here, so that they are defined as code.
- xkub.coolcorp.priv.ansible: This directory is dedicated to Ansible. I store the Ansible tree structure here, along with all the playbooks needed to configure the cluster.
To summarize, here is the complete directory structure I set up to frame Claude Code:
xkub.coolcorp.priv/
├── CLAUDE.md # Objectif global + consignes générales
├── docs/ # Documentation de référence
│ ├── ARCHITECTURE.md # Matériel, IP, choix d'archi
│ ├── CONVENTIONS.md # Nommage & standards (objets K8S)
│ └── ROADMAP.md # Suivi des étapes du cookbook
├── .claude/ # Config Claude Code
│ └── agents/ # Subagents spécialisés
│ ├── it-architect.md # Architecte IT global
│ ├── packer-builder.md # DevOps · Packer
│ ├── terraform-provisioner.md # DevOps · Terraform
│ ├── ansible-engineer.md # DevOps · Ansible
│ ├── k8s-platform-engineer.md # Platform engineer K8S
│ ├── k8s-security-auditor.md # Sécurité Kubernetes
│ └── app-deployment-tester.md # Validation du cluster
├── xkub.coolcorp.priv.packer/ # Dossier Packer
│ └── CLAUDE.md # Cadrage Packer (VM template)
├── xkub.coolcorp.priv.iac/ # Dossier Terraform
│ └── CLAUDE.md # Cadrage Terraform (VMs cluster)
└── xkub.coolcorp.priv.ansible/ # Dossier Ansible
└── CLAUDE.md # Cadrage Ansible (config cluster)
Directory structure of the configuration files for Claude Code (text version).
Subagent
To complement this logic, I have also implemented subagents, a Claude Code feature that lets me rely on domain-specific agents instead of letting Claude Code handle everything with a single generalist agent. It consumes more tokens, but it often produces higher-quality output, since AI has inherited from humans the difficulty of evaluating itself and criticizing its own work. Splitting the workloads across different subagents creates an internal challenge that benefits the final result.
I have placed the following definitions in .claude/agents:
- it-architect.md: This plays the role of a global IT architect, overseeing the design and consistency of the entire system.
- packer-builder.md: This acts as a DevOps specialist focused on Packer. It ensures the correct syntax of Packer files and adherence to best practices.
- terraform-provisioner.md: This is a DevOps role focused on Terraform. It concentrates on verifying the syntax of Terraform files and ensuring that best practices are followed.
- ansible-engineer.md: This acts as a DevOps specialist focused on Ansible. It ensures the correct syntax of Ansible files and adherence to the associated best practices.
- k8s-platform-engineer.md: This acts as a platform engineer specializing in Kubernetes. It ensures the proper configuration of Kubernetes components.
- k8s-security-auditor.md: This plays the role of a cybersecurity expert focused on Kubernetes. It challenges the implementation of the cluster to ensure that security best practices are followed.
- app-deployment-tester.md: This acts as a developer responsible for validating the platform. They can be called upon at various stages to ensure that nothing is broken and that the cluster is functional.
It is very likely that things will evolve over time, and other elements may be added. I will update the article as needed.
In summary, my overall approach to using AI is as follows:
Directory structure of the configuration files for Claude Code.
Important considerations when using AI
AI should not be used haphazardly, and preparing your directory structure along with all the configuration files needed to frame the AI is very important.
This phase should not be neglected, and you should not hesitate to use the AI itself to design your Markdown. Iterating with the AI is a very good practice.
Note that, even though I am using AI to help me build the platform described in this cookbook, the cookbook can still be followed and understood without AI. You do not have to use AI yourself to understand and follow the articles.
AI should remain a tool. You must always retain your understanding of things and the ability to do them yourself.
Introduction to Kubernetes
Several concepts specific to Kubernetes (or K8S) will be presented in this article, but not necessarily detailed at this time. It is therefore possible that some principles may seem confusing if you are not already familiar with the Kubernetes ecosystem. This is not necessarily a problem at this stage.
What is important to know is that Kubernetes is based on a principle of modularity. A Kubernetes cluster consists of several servers, virtual and/or physical, on which functional components run, each with a specific role. Some of these components may be redundant, and are more or less critical for the proper functioning of the cluster. They can also be customized or enhanced according to needs.
Click the image to enlarge.
Interacting with a Kubernetes cluster is primarily interacting with an API. This API has different branches that contain the definition of various objects.
Each object corresponds to a use case, and a certain number of properties, which are mandatory and/or optional. It is the combination of all these objects that can be manipulated through the API that will allow you to run your applications.
You can thus specify the desired state for your resources. Kubernetes will always ensure that the actual state matches your expectations.
Kubernetes is an ecosystem that can quickly become complex. Running an application under K8S involves a whole set of objects described in an API. These objects all have a specific role (managing deployment, providing storage, exposing a service, etc.) and may be dependent on each other to function.
I will provide more details about the role and usage of these objects in dedicated articles, but keep in mind that their manipulation is primarily (but not exclusively) done through YAML files (and soon Kaml, a modified YAML format for K8S), which contain a set of properties describing the characteristics of the targeted object.
However, it is necessary to introduce the concept of pod. I will not go into detail at this level, but be aware that this is the basic object in Kubernetes that allows the execution of one or more containers. Feel free to review the definition of the object to learn more now.
Click the image to enlarge.
One good practice when starting with Kubernetes is to adopt a naming convention for your files and objects. That's why, in the context of AI usage, I have defined my rules in the instructions given to agents via the CONVENTIONS.md file.
In this case, here is the standard that I have adopted
Kubernetes Object
example prd-deploy-myprivatelab_grafana-lan
The - separates the blocks, and the _ connects the application to its role.
Application Namespace
example prd-myprivatelab-lan
Choosing kubeadm and Vanilla Kubernetes
Kubernetes remains a modular solution where each component is available individually. It's up to you to assemble them and potentially modify them to build your cluster. This can be a tedious task, which is why there are Kubernetes "distributions" that will take care of deploying everything necessary on your nodes, whether virtual or physical. These "suites" come with many associated tools, such as graphical user interfaces and assisted update methods. Examples include OpenShift from Red Hat, or RKE2 from Rancher. Even though there are free versions of these solutions, they are generally expensive products aimed at enterprises. A so-called vanilla installation is a deployment that does not rely on a distribution, but instead uses the basic components directly. Fortunately, this type of installation has evolved significantly and is becoming increasingly easier, thanks in part to Kubeadm.
Kubeadm is the official installer associated with the K8S project. It greatly simplifies deployment by preconfiguring all the necessary components based on configuration elements you provide as arguments. Note that other methods exist, such as kubespray, which relies on Ansible.
For my part, I will also use Ansible, but in my own way, mainly to make it easier to create the cluster's configuration files. Finally, be aware that managed solutions are available from major cloud providers. Azure, AWS, or GCP, among others, offer managed clusters that can be deployed with just a few clicks.
This allows you to focus on your applications and not on cluster administration.
Click the image to enlarge.
Why not OpenShift or other ready-to-use distributions?
In the first version of my cookbook, choosing a vanilla Kubernetes cluster could raise doubts for many, due to the operational maintenance it can involve.
Today, when people talk about Kubernetes in enterprises, 9 times out of 10 they end up talking about OpenShift. It is becoming to containerization what VMware was to virtualization.
The Red Hat solution is becoming the default choice for many large organizations that do not want to take the risk of using vanilla Kubernetes.
Especially since OpenShift integrates KubeVirt and therefore also offers an alternative to VMware, providing a response to the crisis following Broadcom's acquisition of VMware, for running VMs.
OpenShift is therefore becoming the increasingly popular universal VM/Container platform.
This makes sense. I myself hesitated a lot about switching to OpenShift for my home lab, especially via the open-source version OKD.
But again, AI has shown me things in a slightly different way and reinforced my choice of a Vanilla cluster.
OpenShift, like other products, particularly from Rancher (K3S, RKE2), offers to hide the complexity of a Vanilla cluster through an out-of-the-box integration of the cluster and the addition of many management layers.
But this famous complexity can be partly challenged thanks to AI. Isn't a subscription to a solution that makes it easier to build a Vanilla cluster worth more than the extra cost of a license that locks you into a certain ecosystem (even if you stay within the K8S universe)?
If internal skills already exist, is it not sufficient to strengthen them through AI? This would limit the need to rely on a third-party vendor and allow you to customize your cluster as much as possible for your needs.
Indeed, your AI provider then becomes your main dependency. Given the current market, nothing guarantees the stability of these offerings, let alone their prices. That said, it would be wise to take advantage of them while the offers are attractive and to strengthen the skills of everyone involved. Furthermore, the rise of open-source LLMs makes them an increasingly credible alternative to paid models for certain needs. (Feel free to read my article on the risks of using AI in business.)
If you use AI intelligently to overcome your fears, reduce initial costs, and increase your knowledge, you may come out ahead. If you consider AI as a qualified assistant offering expertise and additional knowledge, you may not have to pay license fees to vendors for the use of packaged products.
Of course, your production constraints remain, and being able to rely on support can be valuable in case of an incident. For my part, I am keeping my home lab on Vanilla, and if, tomorrow, I have to work on an OpenShift cluster in my professional life, I will still have the know-how and skills on Kubernetes: if you can do the harder thing, you can do the easier one.
It's worth noting that OpenShift is also known for consuming a certain number of resources by default, with a significant runtime footprint because it includes many components that are not always useful for basic needs. Rancher has a lighter catalog in this regard.
However, be careful: if you see AI as an easy solution that excuses you from the need to understand what you're doing, then definitely don't start with a Vanilla cluster.
More broadly, in professional environments, it is not uncommon to encounter mixed installations. One or more on-premises clusters, deployed via Kubeadm or based on a dedicated distribution, such as OpenShift, and other clusters in the cloud, for different needs and workloads. This is one of Kubernetes' greatest strengths. Regardless of the platform, as long as it adheres to the K8S standards, it becomes possible to design a truly hybrid infrastructure where you can choose at any time to run your assets on a particular platform based on your performance, availability, security, and cost constraints.
OS choices for nodes
Previously, I had chosen PhotonOS, a Linux OS primarily maintained by VMware, based on Red Hat, and specialized in running containers. It is one of the minimalist operating systems that are very popular for setting up Kubernetes nodes. But with everything that has happened with VMware/Broadcom, I prefer to avoid solutions related to that vendor as much as possible.
I could then stick with the microOS approach and choose Talos Linux. An immutable OS for Kubernetes that allows for the creation of optimized and very secure clusters.
But, just as with my choice of Vanilla for Kubernetes, I want to stay with a 'classic' OS, even if it means configuring and optimizing it myself.
That's why I chose Rocky Linux. Created in response to Red Hat's change of strategy for CentOS, it is a reliable and stable OS that maintains binary compatibility with Red Hat. Like Alma Linux, it is a multi-purpose, professional-grade distribution.
Click the image to enlarge.
Here too, bringing AI into my thinking ultimately led me to choose a classic OS. It works more easily with other tools that I might need, but it means fewer optimizations and more exposure to security issues. However, I remain open to other options and to the idea of unifying everything under a single base OS. And if I get stuck configuring a component, AI can help with troubleshooting.
Execution infrastructure
Target virtualization platform
I am gradually starting to move on from VMware and its solutions. Even though I remain convinced of the quality of their product and the efficiency of their ecosystem, their business policy and their abandonment of a large part of their customer base have led me to focus on other platforms.
I will therefore rely on my lab running XCP-ng, the hypervisor solution from the company VATES that I have been using for over a year and which I continue to appreciate.
This will also be an opportunity for me to show that this type of platform can be managed perfectly well with the automation tools available on the market and become a fully consistent execution engine for production.
Click the image to enlarge.
Container runtime
Still with a modular approach, the container execution engine is also chosen by the user. This is particularly true for a Vanilla Kubernetes installation.
The world of containerization has evolved greatly, and while Docker was everywhere for a time, used to mean anything and everything, that hasn't been the case for a long time. Indeed, the industry has agreed on a standard via the Open Container Initiative (OCI). Containers are now run by runtimes that comply with this standard. The best known, which is in fact at the origin of the standard, is runc, the component historically used by Docker and "donated" to the OCI.
runc is truly the lowest level component. Above it, you often find containerd, which adds a management environment that is most often controlled through a CLI like Docker's.
But that's not all; Kubernetes also offers its own standard, the Container Runtime Interface (CRI). This describes how Kubernetes interacts with a runtime and how that runtime should behave to be integrated with K8S.
In short, we have a runtime that adheres to the OCI standard, combined with an additional environment that can be managed by Kubernetes because it is compatible with CRI. As for me, I will stick with the classic containerd/runc.
However, starting with Rocky Linux 10 (and therefore Red Hat 10), runc has been replaced on these operating systems by crun. This is a rewrite of runc in C (instead of Go) for reduced memory footprint and various optimizations.
You might encounter both versions, but for this cookbook, we will use crun.
The diagram below illustrates these principles, as well as some storage and networking elements that we will discuss later.
Click the image to enlarge.
Network handling
The core binaries of K8S are focused on container orchestration. For third-party features, such as the container execution engine, their storage, or communication between them, Kubernetes allows you to choose the technologies you want to use. These additional components can be provided by third-party solutions, as long as they adhere to a certain standard and comply with common norms. Regarding networking, Kubernetes offers the CNI (Container Network Interface) specification. Various solutions or "plugins" are based on CNI to handle the network layer within a K8S cluster. Each user can choose the plugin that best suits their needs based on the features it offers: supported routing protocol, ability to use access policies, etc.
The landscape is evolving, but I have chosen Cilium, which seems to be favored in the market for several years now. Incidentally, the company behind this open-source project was acquired at the end of 2023 by Cisco. The success of Cilium is largely due to its implementation of eBPF (Extended Berkeley Packet Filter), a technology launched in the 4.x branch of the Linux Kernel. I don't fully understand what lies behind it, but for Cilium, it provides advanced observability and filtering capabilities for network traffic within a Kubernetes cluster.
Another debate within the K8S community is whether to use nodes in a DMZ or dedicate an entire cluster to exposed network zones.
For me, there are no right or wrong answers. As always, it all depends on the constraints you may have, especially regarding cybersecurity.
By default, Kubernetes follows an "everything is allowed" logic. However, there are many mechanisms to isolate resources from each other and segment your cluster into specific, sealed-off zones.
In my case, I don't have the luxury of creating more clusters, so I will rely on these protection mechanisms to ensure that an asset in the DMZ cannot freely communicate with an asset on the LAN by taking advantage of the internal network within the cluster.
Aside: one or multiple clusters?
It is worth noting that trends have evolved (and will likely continue to evolve): we have moved from "one cluster to rule them all" to "divide and conquer". The trend at the time of writing is to stop using megaclusters in favor of multiple small, specialized Kubernetes clusters. Even though this isn't my choice here, my approach is compatible with this logic. Packaging your K8S Vanilla deployment then makes it possible to deploy multiple clusters on multiple targets. In line with my choice not to use an existing Kubernetes distribution, I believe in the value of designing your own Kubernetes distribution... Without going as far as the level of integration of an OpenShift, I think that designing your own base K8S cluster template so you can redeploy it when needed is a good approach.
Storage handling
In the world of containerization, it is common practice to minimize the need for persistent storage. A container should be able to stop and restart without having to depend on data directly attached to it. However, this mode of operation is not compatible with all use cases. For example, a containerized database will need to access its data. That's why, in K8S, we separate the execution layer from the storage layer. The two are handled through different objects, and it is the combination of the two that allows you to design an application. We will talk about persistentvolumes (pv) to describe the objects responsible for hosting the data.
For my needs, several types of volumes will be set up through what are called storageclasses (sc). These objects allow you to define storage spaces offering certain characteristics (performance, block or file-based…). The cluster can, depending on the requirements, automatically provision a persistent volume in one of these storage classes. This provisioning will be done through a third object, called persistentvolumeclaims (pvc). In principle, a user will describe their storage needs in a pvc, which will be evaluated by the cluster, and the cluster will then offer a pv from the sc that corresponds to the expected characteristics.
The idea is not to go into detail here, but here is a diagram that describes the logic.
Click the image to enlarge.
An sc will most of the time rely on a CSI, for Container Storage Interface: a kind of driver provided by a third party that complies with the standards set by the Kubernetes project. It allows a cluster to drive a storage provider, such as a cloud solution, a specific storage array or a third-party ecosystem with a storage solution. It is an extremely powerful concept, since it makes it possible to offer several ways of hosting persistent data within the cluster, completely transparently, without having to worry about the final storage solution. On one side, infrastructure teams can choose the provider they want, as long as it offers a CSI driver, and on the other, developers can pick the storage class that matches their needs (or that they are allowed to use) without worrying about the rest. If the storage provider were to change, another CSI driver would be declared in the sc without affecting the deployment files.
Here are the sc offered:
- A storage class named prd-sc-longhorn-default-na: This storage class will use the Longhorn CSI driver to create pv directly on local disks in the nodes, or by combining several of these disks into a virtual storage space distributed across multiple nodes. I may well complement this class at some point with the Vates Xen Orchestra CSI, which is under development as I write these lines. This will provide high-performance, block-oriented storage, accessible in read/write mode by one target at a time. In my case, this is typically the storage class I will use for databases.
- A storage class named prd-sc-nfs-default-na: This storage class will rely on a NAS offering an NFS space. The pv created from this storage class can be accessed for both reading and writing by multiple targets simultaneously. In my case, I will use it for the static content of my website or other needs for sharing between different assets.
- A storage class named prd-sc-smb-default-na: This storage class will rely on a NAS offering an SMB space. As with NFS, the pv created from this storage class can be accessed for both reading and writing by multiple targets simultaneously. I don't have a specific use case in mind yet, but it could be interesting when data needs to be shared between Kubernetes and a Windows workstation.
Another type of storage will be used: object storage. I previously used Minio, but its license has completely changed, making the free and open-source version less complete than the paid version. Like many others, I looked for alternatives and chose SeaweedFS (at least one of my colleagues convinced me to use it :).
Object storage will give us an S3 compatibility layer, the widely used AWS API that provides shared access to storage over the web. Feel free to browse my article on Minio if needed; even though I no longer recommend the solution, the general explanations in the article remain valid.
Cluster components
My Kubernetes cluster will consist of three control plane nodes, 3 worker nodes on the LAN, and 2 worker nodes in the DMZ.
With the exception of one node on the LAN, all servers will be VMs running on XCP-ng. Only one node on the LAN will be deployed directly on a physical server running Rocky Linux. This server, equipped with a dedicated GPU, can be used to run containers that require GPU resources.
High availability for the control plane
Control plane nodes (formerly masters) are essential for the proper functioning of the cluster. They host the API server, without which it is impossible to interact with the cluster, and many other critical roles. They also store the key/value database etcd, in which all of the cluster's configuration is stored. (Note that some prefer to use dedicated etcd instances hosted outside of the control plane, or even use other database engines).
We often see examples where a single control plane is used. This is very good for learning or for handling non-critical environments, but in production environments, relying on only one control plane is not sufficient. If this control plane fails, it will impact interaction with the cluster. While having an unavailable control plane does not make applications already running on the cluster inoperable, it eliminates orchestration and makes it impossible to manage the cluster.
Note that you cannot use two control planes to provide high availability (HA), because that is not enough to reach a consensus on the state of the cluster. A third control plane is mandatory so that they can all agree with each other.
If maintaining a cluster of control planes seems daunting, then managed solutions from cloud providers are made for you. In these offerings, you are not responsible for managing the control planes. You simply interact with the K8S API, but it is the responsibility of the cloud provider to ensure the proper functioning of the nodes.
Resource configuration
Regarding the hardware configuration of the VMs hosting the different roles:
- For the control plane nodes, we will use 4 vCPUs and 6 GB of RAM, with 60 GB of disk space.
- For the worker nodes, we will use 4 vCPUs and 6 GB of RAM, with 80 GB of disk space.
These figures may change depending on the cluster's load, but they still leave me some headroom for a home lab.
Proper resource provisioning remains an important consideration under Kubernetes, and therefore, integrating a good monitoring solution is also important.
Control planes, especially due to ETCD, require a minimum amount of resources and should not be subject to contention, even though they do not directly execute application assets.
Also, pay attention to local disks. In my case, they will primarily serve the base operating system, but Kubernetes is also known for writing a large number of events and sometimes heavily utilizing the disks on which it is installed. The use of high-performance SSDs is mandatory at this level, especially on control planes.
API exposure
As mentioned above, the cluster will have three control planes. To ensure high availability for the API they host, it is necessary to expose them through a virtual IP (VIP).
Unlike in my previous cookbook, a Kubernetes component, kube-vip, will handle this.
kube-vip is a small component that runs within the cluster itself, as a static pod on each of the control planes. Its role is to provide a floating VIP dedicated to the Kubernetes API. Based on ARP, this requires all control planes to be on the same L2 network. Furthermore, kube-vip relies on an active/passive management system, which means that at any given time, only one of the control planes will handle all API traffic.
Click the image to enlarge.
Application exposure
If kube-vip handles access to the API, access to my applications will be handled by HAproxy via dedicated servers. This is a well-known and widely used open-source solution. Several HAproxy instances will be deployed to cover external access to applications hosted within the cluster.
Once again, it is important to remember that Kubernetes operates on a modular logic. By default, your application is made accessible through dedicated objects called Services (svc). These can be of different types, but are primarily intended for exposing your assets within the cluster.
When it comes to exposing your applications outside the cluster, the basic functionality remains limited. It is recommended to use additional tools to offer more features.
As always with Kubernetes, exposing your applications outside the cluster requires the use of dedicated objects. Several strategies are possible at this level. Historically, we relied on ingress objects managed by an ingress controller. This was my approach in my previous cookbook. However, as I explained in a dedicated article, the modern target is to use the API Gateway. This project complements K8S and aims to replace ingresses with more modern objects. Even via the API Gateway, you need to use a third-party tool for application exposure.
For my part, I chose the Traefik solution. It's a product that I particularly appreciate.
Click the image to enlarge.
Whereas other solutions like NGINX existed before K8S and later became compatible with it, Traefik was designed for Kubernetes and, more generally, for containerization (don't get me wrong, I'm not saying NGINX is bad).
It can be deployed in several ways on a cluster.
- Either by enhancing the K8S API. In this case, we talk about CustomResourceDefinition (CRD). This involves adding new objects specific to the deployed solution to the basic Kubernetes objects. This allows you to fully leverage Traefik's capabilities, but it does not guarantee that you will find these new objects on managed Kubernetes solutions or those associated with a distribution.
- Or via standard Ingress or Gateway objects. This is the approach I prioritize to stay within the basic K8S API (even though the API Gateway is not enabled by default).
Click the image to enlarge.
Conclusion
It's possible that, for someone who has never worked with Kubernetes, some points may still seem unclear. The purpose here was to quickly cover a few key principles that can be detailed further in the other steps. The important thing is to at least have an idea of the components to deploy and the target to achieve.
We can now continue with the first step of this cookbook: creating the template.