Kubernetes The Hard Way on LXD
This tutorial is based on Kelsey’s Hightower tutorial to deploy Kubernetes the hard way, but using LXC containers in a single virtual host. Some modifications in the config files are required in order to run all servers in a single node. One major reason for bottleneck can be the disk IO needed, making a SSD or M.2 card a must. While deploying etcd on 3 containers, you will see a lot of io requests to store and retrieve data. Spinning disks will make this lab impossible to deploy.
The original excellent guide from Kelsey can be found here: Kubernetes the Hard Way. This guide is an adaptation to his guide, and many steps are exactly the same. This guide has some shell scripts to execute operations on containers. While executing those commands, take in consideration what would you do in several production servers.
Kubernetes The Hard Way
This tutorial walks you through setting up Kubernetes the hard way in a single host using LXC containers. This guide is not for people looking for a fully automated command to bring up a Kubernetes cluster. If that’s what you are looking for, then check out Getting Started Guides.
Kubernetes The Hard Way is optimized for learning, which means taking the long route to ensure you understand each task required to bootstrap a Kubernetes cluster.
The results of this tutorial should not be viewed as production ready, and may receive limited support from the community, but don’t let that stop you from learning!
You can try this tutorial using multipass (https://canonical.com/multipass/install)
Target Audience
The target audience for this tutorial is someone planning to support a production Kubernetes cluster and wants to understand how everything fits together.
Cluster Details
Kubernetes The Hard Way guides you through bootstrapping a highly available Kubernetes cluster with end-to-end encryption between components and RBAC authentication.
- Kubernetes 1.34.3
- containerd Container Runtime 2.2.0
- CNI Container Networking 1.8.0
- etcd v3.6.6
Directory Structure
configs: Configuration files for the Kubernetes services.units: Systemd unit files for the Kubernetes services.docs: The lab documentation.
Labs
This tutorial assumes you have a server with Ubuntu 24.04, and an SSD or M.2 disk where the containers will be running.
- Multipass Instructions
- Prerequisites
- Installing the Client Tools
- Compute Resources
- Provisioning the CA and Generating TLS Certificates
- Generating Kubernetes Configuration Files for Authentication
- Generating the Data Encryption Config and Key
- Bootstrapping the etcd Cluster
- Bootstrapping the Kubernetes Control Plane
- Bootstrapping the Kubernetes Worker Nodes
- Configuring kubectl for Remote Access
- Smoke Test
- Cleaning Up