|
39 | 39 | image: ubuntu-24.04 |
40 | 40 | size: v1-small-x86 |
41 | 41 | --- |
| 42 | +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 |
| 43 | +kind: MetalStackMachineTemplate |
| 44 | +metadata: |
| 45 | + name: metal-test-worker |
| 46 | +spec: |
| 47 | + template: |
| 48 | + spec: |
| 49 | + image: ubuntu-24.04 |
| 50 | + size: v1-small-x86 |
| 51 | +--- |
42 | 52 | kind: KubeadmControlPlane |
43 | 53 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
44 | 54 | metadata: |
@@ -119,3 +129,104 @@ spec: |
119 | 129 | permissions: "0644" |
120 | 130 | content: | |
121 | 131 | disabled_plugins = [] |
| 132 | +--- |
| 133 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 134 | +kind: MachineDeployment |
| 135 | +metadata: |
| 136 | + name: metal-test-md-0 |
| 137 | + labels: |
| 138 | + cluster.x-k8s.io/cluster-name: metal-test |
| 139 | + nodepool: nodepool-0 |
| 140 | +spec: |
| 141 | + clusterName: metal-test |
| 142 | + replicas: 1 |
| 143 | + selector: |
| 144 | + matchLabels: |
| 145 | + cluster.x-k8s.io/cluster-name: metal-test |
| 146 | + nodepool: nodepool-0 |
| 147 | + template: |
| 148 | + metadata: |
| 149 | + labels: |
| 150 | + cluster.x-k8s.io/cluster-name: metal-test |
| 151 | + nodepool: nodepool-0 |
| 152 | + spec: |
| 153 | + nodeDrainTimeout: 120s |
| 154 | + clusterName: metal-test |
| 155 | + version: "v1.30.6" |
| 156 | + bootstrap: |
| 157 | + configRef: |
| 158 | + name: metal-test-md-0 |
| 159 | + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 |
| 160 | + kind: KubeadmConfigTemplate |
| 161 | + infrastructureRef: |
| 162 | + name: metal-test-worker |
| 163 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 164 | + kind: MetalStackMachineTemplate |
| 165 | +--- |
| 166 | +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 |
| 167 | +kind: KubeadmConfigTemplate |
| 168 | +metadata: |
| 169 | + name: metal-test-md-0 |
| 170 | +spec: |
| 171 | + template: |
| 172 | + spec: |
| 173 | + format: ignition |
| 174 | + clusterConfiguration: |
| 175 | + controlPlaneEndpoint: 203.0.113.129:443 |
| 176 | + joinConfiguration: |
| 177 | + nodeRegistration: {} |
| 178 | + ignition: |
| 179 | + containerLinuxConfig: |
| 180 | + additionalConfig: | |
| 181 | + systemd: |
| 182 | + units: |
| 183 | + - name: cluster-api-init.service |
| 184 | + enable: true |
| 185 | + contents: |- |
| 186 | + [Unit] |
| 187 | + Description=Prepares the node for bootstrapping with cluster-api kubeadm |
| 188 | + Before=kubeadm.service |
| 189 | + After=network-online.target |
| 190 | + Wants=network-online.target |
| 191 | + [Service] |
| 192 | + Type=oneshot |
| 193 | + Restart=on-failure |
| 194 | + RestartSec=5 |
| 195 | + StartLimitBurst=0 |
| 196 | + EnvironmentFile=/etc/environment |
| 197 | + ExecStart=/var/lib/cluster-api-init/bootstrap.sh |
| 198 | + [Install] |
| 199 | + WantedBy=multi-user.target |
| 200 | + files: |
| 201 | + - path: /var/lib/cluster-api-init/bootstrap.sh |
| 202 | + owner: "root:root" |
| 203 | + permissions: "0744" |
| 204 | + content: | |
| 205 | + #!/usr/bin/env bash |
| 206 | + set -eo pipefail |
| 207 | + set +x |
| 208 | +
|
| 209 | + apt update |
| 210 | + apt install conntrack |
| 211 | +
|
| 212 | + CNI_PLUGINS_VERSION="v1.3.0" |
| 213 | + DEST="/opt/cni/bin" |
| 214 | + mkdir -p "$DEST" |
| 215 | + curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-amd64-${CNI_PLUGINS_VERSION}.tgz" | tar -C "$DEST" -xz |
| 216 | +
|
| 217 | + RELEASE="v1.30.6" |
| 218 | + cd /usr/local/bin |
| 219 | + curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl} |
| 220 | + chmod +x {kubeadm,kubelet,kubectl} |
| 221 | +
|
| 222 | + RELEASE_VERSION="v0.16.2" |
| 223 | + curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/krel/templates/latest/kubelet/kubelet.service" | sed "s:/usr/bin:/usr/local/bin:g" | tee /usr/lib/systemd/system/kubelet.service |
| 224 | + mkdir -p /usr/lib/systemd/system/kubelet.service.d |
| 225 | + curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/krel/templates/latest/kubeadm/10-kubeadm.conf" | sed "s:/usr/bin:/usr/local/bin:g" | tee /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf |
| 226 | +
|
| 227 | + systemctl enable kubelet.service |
| 228 | + - path: /etc/containerd/config.toml |
| 229 | + owner: "root:root" |
| 230 | + permissions: "0644" |
| 231 | + content: | |
| 232 | + disabled_plugins = [] |
0 commit comments