Skip to content

Commit

Permalink
add new etcd-disk flavor (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDumaine authored Apr 17, 2024
1 parent f9b8308 commit fa66dc0
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Flavors](./topics/flavors/flavors.md)
- [Default (kubeadm)](./topics/flavors/default.md)
- [Dual-stack (kubeadm)](./topics/flavors/dual-stack.md)
- [Etcd-disk (kubeadm)](./topics/flavors/etcd-disk.md)
- [ClusterClass kubeadm](./topics/flavors/clusterclass-kubeadm.md)
- [k3s](./topics/flavors/k3s.md)
- [rke2](./topics/flavors/rke2.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/src/topics/disks/data-disks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ There are a couple caveats with specifying disks for a linode instance:
Currently SDB is being used by a swap disk, replacing this disk with a data disk will slow down linode creation by
up to 90 seconds. This will be resolved when the disk creation refactor is finished in PR [#216](https://github.com/linode/cluster-api-provider-linode/pull/216)
```

## Specify a data disk
A LinodeMachine can be configured with additional data disks with the key being the device to be mounted as and including an optional label and size.

* `size` Required field. [resource.Quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/) for the size if a disk. The sum of all data disks must not be more than allowed by the [linode plan](https://www.linode.com/pricing/#compute-shared).
* `label` Optional field. The label for the disk, defaults to the device name
* `diskID` Optional field used by the controller to track disk IDs, this should not be set unless a disk is created outside CAPL
Expand Down
10 changes: 7 additions & 3 deletions docs/src/topics/etcd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ This guide covers etcd configuration for the control plane of provisioned CAPL c

## Default configuration

By default, etcd is configured to be on a separate device from the root filesystem on
control plane nodes. The etcd disk is automatically sized at 10 GB with a quota backend of 8 GB per
recommendation from [the etcd documentation](https://etcd.io/docs/latest/dev-guide/limit/#storage-size-limit)
The `quota-backend-bytes` for etcd is set to `8589934592` (8 GiB) per recommendation from
[the etcd documentation](https://etcd.io/docs/latest/dev-guide/limit/#storage-size-limit).

By default, etcd is configured to be on the same disk as the root filesystem on
control plane nodes. If users prefer etcd to be on a separate disk, see the
[etcd-disk flavor](flavors/etcd-disk.md).


## ETCD Backups

Expand Down
26 changes: 26 additions & 0 deletions docs/src/topics/flavors/etcd-disk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Etcd-disk

This flavor configures etcd to be on a separate disk from the OS disk.
By default it configures the size of the disk to be 10 GiB and sets
the `quota-backend-bytes` to `8589934592` (8 GiB) per recommendation from
[the etcd documentation](https://etcd.io/docs/latest/dev-guide/limit/#storage-size-limit).

## Specification
| Control Plane | CNI | Default OS | Installs ClusterClass | IPv4 | IPv6 |
|---------------|--------|--------------|-----------------------|------|------|
| Kubeadm | Cilium | Ubuntu 22.04 | No | Yes | No |

## Prerequisites
[Quickstart](../getting-started.md) completed

## Usage
1. Generate cluster yaml
```bash
clusterctl generate cluster test-cluster \
--infrastructure linode:0.0.0 \
--flavor etcd-disk > test-cluster.yaml
```
2. Apply cluster yaml
```bash
kubectl apply -f test-cluster.yaml
```
8 changes: 0 additions & 8 deletions templates/flavors/default/kubeadmControlPlane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ spec:
controllerManager:
extraArgs:
cloud-provider: external
diskSetup:
filesystems:
- label: etcd_data
filesystem: ext4
device: /dev/sdc
mounts:
- - LABEL=etcd_data
- /var/lib/etcd_data
initConfiguration:
nodeRegistration:
kubeletExtraArgs:
Expand Down
42 changes: 42 additions & 0 deletions templates/flavors/etcd-disk/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../default

patches:
- target:
group: infrastructure.cluster.x-k8s.io
version: v1alpha1
kind: LinodeMachineTemplate
name: .*-control-plane
patch: |-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeMachineTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
spec:
template:
spec:
dataDisks:
sdc:
label: etcd_disk
size: 10Gi
- target:
group: controlplane.cluster.x-k8s.io
version: v1beta1
kind: KubeadmControlPlane
patch: |-
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
spec:
kubeadmConfigSpec:
diskSetup:
filesystems:
- label: etcd_data
filesystem: ext4
device: /dev/sdc
mounts:
- - LABEL=etcd_data
- /var/lib/etcd_data

0 comments on commit fa66dc0

Please sign in to comment.