How to add baremetal servers to your cluster

This guide provides the information you need to add your baremetal machines to your cluster.

note

Autopilot only manages the installation of necessary software on bare metal machines and the adding/removing of machines from the cluster. Autopilot does NOT buy nor sell the servers.

Define the HetznerBareMetalHost

Create a baremetalhosts.yaml file, following the example below:

baremetalhosts.yaml yaml
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: HetznerBareMetalHost metadata: name: baremetal-1 spec: description: My first baremetal machine // [!code tooltip:1234567:1:Replace with the Server ID of your machine] serverID: 1234567 rootDeviceHints: // [!code tooltip:eui.726163646f6d2d2d:1:Replace with the WWN of the disk in your machine] wwn: eui.726163646f6d2d2d maintenanceMode: false --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: HetznerBareMetalHost metadata: name: baremetal-2 spec: description: My second baremetal machine // [!code tooltip:1234567:1:Replace with the Server ID of your machine] serverID: 7654321 rootDeviceHints: // [!code tooltip:eui.726163646f6d2d2d:1:Replace with the WWN of the disk in your machine] wwn: eui.737472696e677349cd maintenanceMode: false

And apply it to your management cluster.

warning

If the baremetal machines were previously configured to use RAID, you must follow the steps in Wiping baremetal server disks before adding them to your cluster. If you have already added them to your cluster, you will need to remove and reapply the HetznerBareMetalHosts after wiping the disk.

By default, newly purchased machines come with RAID enabled. If you are unsure whether you need RAID or not, we recommend that you disable it.

Use your hosts in the cluster

Edit your Cluster resource in the management cluster (or cluster.yaml in your GitOps repository), adding the snippet below to spec.topology.workers.machineDeployments :

yaml
- class: workeramd64baremetal name: md-1 replicas: 2

Now, your cluster will request two machines from the baremetal class. Since you have exactly two hosts, all of them will be used. If you want to prioritize specific machines for addition, you can use labels and selectors:

Add a label to your machine:

baremetalhost.yaml yaml
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: HetznerBareMetalHost metadata: name: baremetal-1 labels: // [!code ++] environment: production // [!code ++] spec: description: My first baremetal machine serverID: 1234567 rootDeviceHints: wwn: eui.726163646f6d2d2d maintenanceMode: false

And use matchLabels to select it in your Cluster resource, under spec.topology.workers :

yaml
- class: workeramd64baremetal name: md-2 replicas: 1 variables: // [!code ++] overrides: // [!code ++] - name: workerHostSelectorBareMetal // [!code ++] value: // [!code ++] matchLabels: // [!code ++] environment: production // [!code ++]
Previous
Adding HCloud servers
Next
Labelling and assign roles on nodes