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.
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 Google Kubernetes Engine, or the Getting Started Guides. For a complete deployment using juju on LXD, you can use conjure Please note that the deployment with conjure is slightly differen than this tutorial and uses different components and versions.
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 in a VM created with Virtualbox, make sure to create the VM in a host with and SSD or M.2 card for storage.
or you can try this tutorial using multipass (https://multipass.run/)
The target audience for this tutorial is someone planning to support a production Kubernetes cluster and wants to understand how everything fits together.
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.22.3
- containerd Container Runtime 1.4.4
- gVisor 50c283b9f56bb7200938d9e207355f05f79f0d17
- CNI Container Networking 0.9.1
- etcd v3.4.15
- CoreDNS v1.8
This tutorial assumes you have a server with Ubuntu 20.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
- Deploying the DNS Cluster Add-on
- Smoke Test
- Cleaning Up
I ran using Multipass; If you have very little memory (say 8GB), I recommend this option. https://multipass.run I was able to run the entire k8s cluster (3+1+3 nodes) with less than 2GB.