|
| 1 | +--- |
| 2 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 3 | +kind: Cluster |
| 4 | +metadata: |
| 5 | + name: metal-test |
| 6 | +spec: |
| 7 | + clusterNetwork: |
| 8 | + pods: |
| 9 | + cidrBlocks: ["192.168.0.0/16"] |
| 10 | + controlPlaneRef: |
| 11 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 12 | + kind: KubeadmControlPlane |
| 13 | + name: metal-test-controlplane |
| 14 | + infrastructureRef: |
| 15 | + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 |
| 16 | + kind: MetalStackCluster |
| 17 | + name: metal-test |
| 18 | +--- |
| 19 | +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 |
| 20 | +kind: MetalStackCluster |
| 21 | +metadata: |
| 22 | + name: metal-test |
| 23 | +spec: |
| 24 | + projectID: 00000000-0000-0000-0000-000000000001 |
| 25 | + partition: mini-lab |
| 26 | + firewall: |
| 27 | + size: v1-small-x86 |
| 28 | + image: firewall-ubuntu-3.0 |
| 29 | + networks: |
| 30 | + - internet-mini-lab |
| 31 | +--- |
| 32 | +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 |
| 33 | +kind: MetalStackMachineTemplate |
| 34 | +metadata: |
| 35 | + name: metal-test-controlplane |
| 36 | +spec: |
| 37 | + template: |
| 38 | + spec: |
| 39 | + image: ubuntu-24.04 |
| 40 | + size: v1-small-x86 |
| 41 | +--- |
| 42 | +kind: KubeadmControlPlane |
| 43 | +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 44 | +metadata: |
| 45 | + name: metal-test-controlplane |
| 46 | +spec: |
| 47 | + replicas: 1 |
| 48 | + version: v1.30.6 |
| 49 | + machineTemplate: |
| 50 | + nodeDrainTimeout: 10m |
| 51 | + infrastructureRef: |
| 52 | + kind: MetalStackMachineTemplate |
| 53 | + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 |
| 54 | + name: metal-test-controlplane |
| 55 | + kubeadmConfigSpec: |
| 56 | + format: ignition |
| 57 | + clusterConfiguration: |
| 58 | + controlPlaneEndpoint: 203.0.113.129:443 |
| 59 | + initConfiguration: |
| 60 | + localAPIEndpoint: |
| 61 | + advertiseAddress: 10.0.0.2 |
| 62 | + bindPort: 443 |
| 63 | + nodeRegistration: {} |
| 64 | + joinConfiguration: |
| 65 | + controlPlane: {} |
| 66 | + nodeRegistration: {} |
| 67 | + ignition: |
| 68 | + containerLinuxConfig: |
| 69 | + additionalConfig: | |
| 70 | + systemd: |
| 71 | + units: |
| 72 | + - name: cluster-api-init.service |
| 73 | + enable: true |
| 74 | + contents: |- |
| 75 | + [Unit] |
| 76 | + Description=Prepares the node for bootstrapping with cluster-api kubeadm |
| 77 | + Before=kubeadm.service |
| 78 | + After=network-online.target |
| 79 | + Wants=network-online.target |
| 80 | + [Service] |
| 81 | + Type=oneshot |
| 82 | + Restart=on-failure |
| 83 | + RestartSec=5 |
| 84 | + StartLimitBurst=0 |
| 85 | + EnvironmentFile=/etc/environment |
| 86 | + ExecStart=/var/lib/cluster-api-init/bootstrap.sh |
| 87 | + [Install] |
| 88 | + WantedBy=multi-user.target |
| 89 | + files: |
| 90 | + - path: /var/lib/cluster-api-init/bootstrap.sh |
| 91 | + owner: "root:root" |
| 92 | + permissions: "0744" |
| 93 | + content: | |
| 94 | + #!/usr/bin/env bash |
| 95 | + set -eo pipefail |
| 96 | + set +x |
| 97 | +
|
| 98 | + apt update |
| 99 | + apt install conntrack |
| 100 | +
|
| 101 | + CNI_PLUGINS_VERSION="v1.3.0" |
| 102 | + DEST="/opt/cni/bin" |
| 103 | + mkdir -p "$DEST" |
| 104 | + curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-amd64-${CNI_PLUGINS_VERSION}.tgz" | sudo tar -C "$DEST" -xz |
| 105 | +
|
| 106 | + RELEASE="v1.30.6" |
| 107 | + cd /usr/local/bin |
| 108 | + sudo curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl} |
| 109 | + sudo chmod +x {kubeadm,kubelet,kubectl} |
| 110 | +
|
| 111 | + RELEASE_VERSION="v0.16.2" |
| 112 | + 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" | sudo tee /usr/lib/systemd/system/kubelet.service |
| 113 | + sudo mkdir -p /usr/lib/systemd/system/kubelet.service.d |
| 114 | + 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" | sudo tee /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf |
| 115 | +
|
| 116 | + systemctl enable kubelet.service |
| 117 | + - path: /etc/containerd/config.toml |
| 118 | + owner: "root:root" |
| 119 | + permissions: "0644" |
| 120 | + content: | |
| 121 | + disabled_plugins = [] |
0 commit comments