Assign L2 templates to machines¶
To deploy MOSK on bare metal, you must create L2 templates for each node type in the MOSK cluster. Additionally, you may have to create separate templates for nodes of the same type when they have different configuration.
To assign specific L2 templates to machines in a cluster:
Select from the following options to assign the templates to the cluster:
Since MOSK 23.3, use the
cluster.sigs.k8s.io/cluster-namelabel in thelabelssection.Before MOSK 23.3, use the
clusterRefparameter in thespecsection.
Add a unique identifier label to every L2 template. Typically, that would be the name of the MOSK node role, for example
l2template-compute, orl2template-compute-5nics.Assign an L2 template to a machine. Set the
l2TemplateSelectorfield in the machine spec to the name of the label added in the previous step. IPAM Controller uses this field to use a specific L2 template for the corresponding machine.Alternatively, you may set the
l2TemplateSelectorfield to the name of the L2 template.
Consider the following examples of an L2 template assignment to a machine.
apiVersion: ipam.mirantis.com/v1alpha1
kind: L2Template
metadata:
name: example-node-netconfig
namespace: my-project
labels:
kaas.mirantis.com/provider: baremetal
kaas.mirantis.com/region: region-one
l2template-example-node-netconfig: "1"
cluster.sigs.k8s.io/cluster-name: my-cluster
...
Note
The kaas.mirantis.com/region label is removed from all MOSK
objects in 24.1. Therefore, do not add the label starting with this release.
On existing clusters updated to this release, or if added manually, MOSK
ignores this label.
Note
Before MOSK 23.3, an L2 template requires
clusterRef: <clusterName> in the spec section. Since MOSK 23.3,
this parameter is deprecated and automatically
migrated to the cluster.sigs.k8s.io/cluster-name: <clusterName> label.
apiVersion: cluster.k8s.io/v1alpha1
kind: Machine
metadata:
name: machine1
namespace: my-project
labels:
cluster.sigs.k8s.io/cluster-name: my-cluster
...
...
spec:
providerSpec:
value:
l2TemplateSelector:
label: l2template-example-node-netconfig
...
apiVersion: cluster.k8s.io/v1alpha1
kind: Machine
metadata:
name: machine1
namespace: my-project
labels:
cluster.sigs.k8s.io/cluster-name: my-cluster
...
...
spec:
providerSpec:
value:
l2TemplateSelector:
name: example-node-netconfig
...
Now, proceed to Deploy a machine to a specific bare metal host.