From e450555b58b76254829d71cd214631a082df9934 Mon Sep 17 00:00:00 2001 From: Ashley Dumaine Date: Wed, 17 Apr 2024 10:52:11 -0400 Subject: [PATCH] add new etcd-disk flavor --- docs/src/SUMMARY.md | 1 + docs/src/topics/data-disks.md | 1 + docs/src/topics/disks.md | 1 + docs/src/topics/disks/data-disks.md | 2 + docs/src/topics/etcd.md | 7 +-- docs/src/topics/flavors/etcd-disk.md | 26 ++++++++++ docs/src/topics/os-disk.md | 1 + .../flavors/default/kubeadmControlPlane.yaml | 13 ----- .../flavors/etcd-disk/kustomization.yaml | 48 +++++++++++++++++++ 9 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 docs/src/topics/data-disks.md create mode 100644 docs/src/topics/disks.md create mode 100644 docs/src/topics/flavors/etcd-disk.md create mode 100644 docs/src/topics/os-disk.md create mode 100644 templates/flavors/etcd-disk/kustomization.yaml diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 9631acc35..666f15486 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -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) diff --git a/docs/src/topics/data-disks.md b/docs/src/topics/data-disks.md new file mode 100644 index 000000000..f63051d83 --- /dev/null +++ b/docs/src/topics/data-disks.md @@ -0,0 +1 @@ +# Data Disks diff --git a/docs/src/topics/disks.md b/docs/src/topics/disks.md new file mode 100644 index 000000000..562fb081f --- /dev/null +++ b/docs/src/topics/disks.md @@ -0,0 +1 @@ +# Disks diff --git a/docs/src/topics/disks/data-disks.md b/docs/src/topics/disks/data-disks.md index 3e0be89e5..ace87b9af 100644 --- a/docs/src/topics/disks/data-disks.md +++ b/docs/src/topics/disks/data-disks.md @@ -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 diff --git a/docs/src/topics/etcd.md b/docs/src/topics/etcd.md index 788baf045..5d8c77d82 100644 --- a/docs/src/topics/etcd.md +++ b/docs/src/topics/etcd.md @@ -4,9 +4,10 @@ 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) +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 diff --git a/docs/src/topics/flavors/etcd-disk.md b/docs/src/topics/flavors/etcd-disk.md new file mode 100644 index 000000000..7f60a93b2 --- /dev/null +++ b/docs/src/topics/flavors/etcd-disk.md @@ -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 + ``` diff --git a/docs/src/topics/os-disk.md b/docs/src/topics/os-disk.md new file mode 100644 index 000000000..86a8a0425 --- /dev/null +++ b/docs/src/topics/os-disk.md @@ -0,0 +1 @@ +# OS Disk diff --git a/templates/flavors/default/kubeadmControlPlane.yaml b/templates/flavors/default/kubeadmControlPlane.yaml index 18da0769a..d057a780a 100644 --- a/templates/flavors/default/kubeadmControlPlane.yaml +++ b/templates/flavors/default/kubeadmControlPlane.yaml @@ -36,25 +36,12 @@ spec: preKubeadmCommands: - /kubeadm-pre-init.sh '{{ ds.meta_data.label }}' "${KUBERNETES_VERSION}" clusterConfiguration: - etcd: - local: - dataDir: /var/lib/etcd_data/etcd - extraArgs: - quota-backend-bytes: "8589934592" apiServer: extraArgs: cloud-provider: external 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: diff --git a/templates/flavors/etcd-disk/kustomization.yaml b/templates/flavors/etcd-disk/kustomization.yaml new file mode 100644 index 000000000..4857a2cd1 --- /dev/null +++ b/templates/flavors/etcd-disk/kustomization.yaml @@ -0,0 +1,48 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../default + +patches: + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha1 + kind: LinodeMachineTemplate + name: ${CLUSTER_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: + clusterConfiguration: + etcd: + local: + dataDir: /var/lib/etcd_data/etcd + extraArgs: + quota-backend-bytes: "8589934592" + diskSetup: + filesystems: + - label: etcd_data + filesystem: ext4 + device: /dev/sdc + mounts: + - - LABEL=etcd_data + - /var/lib/etcd_data