From ca3e606ad060aed26f7dfd945ad9b5427b179952 Mon Sep 17 00:00:00 2001 From: Ray chan Date: Tue, 14 Oct 2025 15:23:24 +0800 Subject: [PATCH 1/4] refactor: remove unused scripts --- .../testing-ha/k8s-kubeadm-lxd/justfile | 7 - .../testing-ha/k8s-kubeadm-lxd/scripts/run.sh | 169 ------------------ 2 files changed, 176 deletions(-) delete mode 100644 deployments/testing-ha/k8s-kubeadm-lxd/justfile delete mode 100755 deployments/testing-ha/k8s-kubeadm-lxd/scripts/run.sh diff --git a/deployments/testing-ha/k8s-kubeadm-lxd/justfile b/deployments/testing-ha/k8s-kubeadm-lxd/justfile deleted file mode 100644 index be131fe..0000000 --- a/deployments/testing-ha/k8s-kubeadm-lxd/justfile +++ /dev/null @@ -1,7 +0,0 @@ -[private] -default: - @just --list - -# Setup development environment (snap try) -init: - TG_CTX_TF_PATH=$(which terragrunt) ./hooks/init.sh diff --git a/deployments/testing-ha/k8s-kubeadm-lxd/scripts/run.sh b/deployments/testing-ha/k8s-kubeadm-lxd/scripts/run.sh deleted file mode 100755 index cc93293..0000000 --- a/deployments/testing-ha/k8s-kubeadm-lxd/scripts/run.sh +++ /dev/null @@ -1,169 +0,0 @@ -#!/bin/bash - -# Function to print error messages and exit -function error_exit { - echo -e "\033[31mError: $1\033[0m" >&2 - exit 1 -} - -# Function to print success messages -function success_message { - echo -e "\033[32m$1\033[0m" -} - -# Function to print info messages -function info_message { - echo -e "\033[34m$1\033[0m" -} - -# Function to print usage/help message -function print_usage { - cat < Date: Tue, 14 Oct 2025 15:30:28 +0800 Subject: [PATCH 2/4] feat: reduce the number of node but increase disk size --- deployments/testing-ha/k8s-kubeadm-lxd/terragrunt.hcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployments/testing-ha/k8s-kubeadm-lxd/terragrunt.hcl b/deployments/testing-ha/k8s-kubeadm-lxd/terragrunt.hcl index b89c191..201110e 100644 --- a/deployments/testing-ha/k8s-kubeadm-lxd/terragrunt.hcl +++ b/deployments/testing-ha/k8s-kubeadm-lxd/terragrunt.hcl @@ -33,13 +33,13 @@ inputs = { ssh_import_id = "gh:chanchiwai-ray" node_prefix = "k8s" image = "ubuntu:24.04" - num = 4 + num = 2 cpu = 2 disks = 0 memory = "4GiB" snap = "hello-world" # dummy snap snap_channel = "latest/stable" # dummy snap channel root_pool = "default" - root_disk_size = "30GiB" + root_disk_size = "50GiB" } From 95e5f050bf03e438f461b2d22816344e891cc01b Mon Sep 17 00:00:00 2001 From: Ray chan Date: Wed, 15 Oct 2025 13:57:17 +0800 Subject: [PATCH 3/4] docs: update README.md --- .../testing-ha/k8s-kubeadm-lxd/README.md | 59 +++++++++++++++++-- .../testing-ha/k8s-kubeadm-lxd/hooks/init.sh | 2 +- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/deployments/testing-ha/k8s-kubeadm-lxd/README.md b/deployments/testing-ha/k8s-kubeadm-lxd/README.md index aa4dc68..7d13e94 100644 --- a/deployments/testing-ha/k8s-kubeadm-lxd/README.md +++ b/deployments/testing-ha/k8s-kubeadm-lxd/README.md @@ -1,16 +1,67 @@ # Deploy Kubernetes cluster using kubeadm -This terragrunt module set up LXD VMs ready for bootstraping a Kubernetes cluster using kubeadm -admin. +This terragrunt module set up LXD VMs ready for bootstraping a Kubernetes cluster using kubeadm. The VMs will be +configured to have necessary packages (`kubeadm`, `kubectl`, ...) to begin with. ## Quickstart ```shell -terragrunt apply +terragrunt apply # deploy the VMs +terragrunt output # get the IP addresses for the VMs ``` -## Clean up +## Exercise 1: Create the control plane node + +1. Create the k8s control plane using `kubeadm` in `k8s-0`. +2. Install a container network interface (CNI), such as `cilium`, to make the all the pods happy. + +References: +- https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/ +- https://docs.cilium.io/en/stable/installation/k8s-install-helm/ + +## Exercise 2: Add a worker node + +1. Add a worker node (`k8s-1`) to the k8s cluster. +2. Label and taint the nodes appropriately if not already done so. + * The worker node should not have any taints. + * The worker node should have a role of `worker`. + + +## Exercise 3: Upgrade the control plane and worker node + +1. Upgrade the control plane node +2. Upgrade the worker node + +## Exercise 4: Install a container storage interface +1. Install container storage interface (CSI), such as `rawfile-localpv` + +## Exercise 5: Install a loadbalancer, ingress controller, and / or a gateway controller + +1. Install a loadbalancer +2. Install an ingress controller +3. Install a gateway controller (typically provided also by CNI) + +Tips: + +1. kubectl apply -f ippool.yaml + +```yaml +# ippool.yaml +apiVersion: "cilium.io/v2" +kind: CiliumLoadBalancerIPPool +metadata: + name: "blue-pool" +spec: + blocks: + - cidr: "10.8.0.0/24" +``` + +References: +- https://docs.cilium.io/en/stable/network/lb-ipam/ +- https://docs.cilium.io/en/stable/network/servicemesh/gateway-api/gateway-api/ + +## Clean up ```shell terragrunt apply --destroy diff --git a/deployments/testing-ha/k8s-kubeadm-lxd/hooks/init.sh b/deployments/testing-ha/k8s-kubeadm-lxd/hooks/init.sh index 85cf374..15547d8 100755 --- a/deployments/testing-ha/k8s-kubeadm-lxd/hooks/init.sh +++ b/deployments/testing-ha/k8s-kubeadm-lxd/hooks/init.sh @@ -13,7 +13,7 @@ non_control_nodes="${nodes[@]:1}" echo "Initializing k8s machines..." echo "Initializing k8s control node..." ssh ubuntu@$control_node -- "ssh-keygen -t rsa -b 2048 -N '' -f ~/.ssh/id_rsa -q <<< n > /dev/null 2>&1 || true && touch ~/.ssh/known_hosts" -echo "Initializing microceph control node... Done" +echo "Initializing k8s control node... Done" echo "Populating the public key of the control node to other nodes..." control_node_name="$(ssh ubuntu@$control_node -- hostname)" From 7d4c2b3322400a0af73a27ab3fca1f3f2420ece5 Mon Sep 17 00:00:00 2001 From: Ray Chan Date: Wed, 21 Jan 2026 11:25:52 +0800 Subject: [PATCH 4/4] Update deployments/testing-ha/k8s-kubeadm-lxd/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- deployments/testing-ha/k8s-kubeadm-lxd/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/testing-ha/k8s-kubeadm-lxd/README.md b/deployments/testing-ha/k8s-kubeadm-lxd/README.md index 7d13e94..628cfce 100644 --- a/deployments/testing-ha/k8s-kubeadm-lxd/README.md +++ b/deployments/testing-ha/k8s-kubeadm-lxd/README.md @@ -1,6 +1,6 @@ # Deploy Kubernetes cluster using kubeadm -This terragrunt module set up LXD VMs ready for bootstraping a Kubernetes cluster using kubeadm. The VMs will be +This terragrunt module set up LXD VMs ready for bootstrapping a Kubernetes cluster using kubeadm. The VMs will be configured to have necessary packages (`kubeadm`, `kubectl`, ...) to begin with. ## Quickstart