Deploy a machine to a specific bare metal host

A machine in a MOSK cluster requires dedicated bare metal host for deployment. In the Mirantis Container Cloud management API, bare metal hosts are represented by the BareMetalHost objects that are automatically generated by the related BareMetalHostInventory objects.

Note

The BareMetalHostInventory resource is available since the update of the management cluster to the Cluster release 16.4.0 (Container Cloud 2.29.0). Before this release, the BareMetalHost object is used.

Since the above mentioned release, BareMetalHost is only used for internal purposes of the Container Cloud private API. All configuration changes must be applied using the BareMetalHostInventory objects.

For any existing BareMetalHost object, a BareMetalHostInventory object is created automatically during cluster update.

m:kaas@management-admin only. This limitation is lifted once the management cluster is updated to the Cluster release 16.4.1 or later.

All BareMetalHostInventory objects must be labeled upon creation with a label that allows identifying the host and assigning it to a machine.

The labels may be unique, or applied to a group of hosts, based on similarities in their capacity, capabilities and hardware configuration, on their location, suitable role, or a combination of thereof.

In some cases, you may need to deploy a machine to a specific bare metal host. This is especially useful when some of your bare metal hosts have different hardware configuration than the rest.

To deploy a machine to a specific bare metal host:

  1. Log in to the host where your management cluster kubeconfig is located and where kubectl is installed.

  2. Identify the bare metal host that you want to associate with the specific machine. For example, host host-1.

    kubectl get baremetalhostinventory host-1 -o yaml
    
    kubectl get baremetalhost host-1 -o yaml
    
  3. Add a label that will uniquely identify this host, for example, by the name of the host and machine that you want to deploy on it.

    kubectl edit baremetalhostinventory host-1
    

    Note

    For details about labels, see BareMetalHostInventory resource.

    kubectl edit baremetalhost host-1
    

    Note

    For details about labels, see BareMetalHost resource.

    Configuration example:

    kind: BareMetalHostInventory
    metadata:
      name: host-1
      namespace: myProjectName
      labels:
        kaas.mirantis.com/baremetalhost-id: host-1-worker-HW11-cad5
        ...
    
    kind: BareMetalHost
    metadata:
      name: host-1
      namespace: myProjectName
      labels:
        kaas.mirantis.com/baremetalhost-id: host-1-worker-HW11-cad5
        ...
    
  4. Open the text file with the YAML definition of the Machine object, created in Create a machine using CLI.

  5. Add a host selector that matches the label you have added to the BareMetalHost object in the previous step. For example:

    kind: Machine
    metadata:
      name: worker-HW11-cad5
      namespace: myProjectName
    spec:
      ...
      providerSpec:
        value:
          apiVersion: baremetal.k8s.io/v1alpha1
          kind: BareMetalMachineProviderSpec
          ...
          hostSelector:
            matchLabels:
              kaas.mirantis.com/baremetalhost-id: host-1-worker-HW11-cad5
      ...
    

Once created, this machine will be associated with the specified bare metal host, and you can return to Create a machine using CLI.

Caution

The required minimum number of machines:

  • 3 manager nodes for HA

  • 3 worker storage nodes for a minimal Ceph cluster