Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 55 additions & 4 deletions deployments/testing-ha/k8s-kubeadm-lxd/README.md
Original file line number Diff line number Diff line change
@@ -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 bootstrapping 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
Expand Down
2 changes: 1 addition & 1 deletion deployments/testing-ha/k8s-kubeadm-lxd/hooks/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
7 changes: 0 additions & 7 deletions deployments/testing-ha/k8s-kubeadm-lxd/justfile

This file was deleted.

169 changes: 0 additions & 169 deletions deployments/testing-ha/k8s-kubeadm-lxd/scripts/run.sh

This file was deleted.

4 changes: 2 additions & 2 deletions deployments/testing-ha/k8s-kubeadm-lxd/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}