Switch L2 templates to the new format

Before the Container Cloud 2.9.0, you were able to configure any network interface except the default provisioning NIC for the PXE and LCM managed to manager connection. Since Container Cloud 2.9.0, you can configure any interface if required.

Caution

  • Deploy any new node using the updated L2 template format.

  • All L2 templates created before Container Cloud 2.9.0 are now deprecated and must not be used.

In the old L2 templates format, ipamhost spawns 2 structures after processing l2template for machines:

  • l2template:status:osMetadataNetwork that renders automatically using the default subnet from the management cluster and is used during the cloud-init deployment phase after provisioning is done

  • l2template:status:npTemplate that is used during the lcm-agent deployment phase and applied after lcmmachine starts deployment

In the new L2 templates format, l2template:status:npTemplate is used directly during provisioning. Therefore, a hardware node obtains and applies a complete network configuration during the first system boot.

To switch to the new L2 template format:

  1. If you do not have a subnet for connection to the management LCM cluster network (lcm-nw), manually create one. For details, see Operations Guide: Create subnets.

  2. Manually create a new L2 template that is based on your existing one. For details, see Operations Guide: Create L2 templates.

  3. In the npTemplate section, add the {{ nic 0}} parameters for the lcm-nw network.

    Configuration example:

    apiVersion: ipam.mirantis.com/v1alpha1
    kind: L2Template
    metadata:
      labels:
        bm-1490-template-controls-netplan: anymagicstring
        cluster.sigs.k8s.io/cluster-name: child-cluster
        kaas.mirantis.com/provider: baremetal
        kaas.mirantis.com/region: region-one
      name: bm-1490-template-controls-netplan
      namespace: child-ns
    spec:
      l3Layout:
        - subnetName: lcm-nw
          scope:      namespace
      ifMapping:
        - enp9s0f0
        - enp9s0f1
        - eno1
        - ens3f1
      npTemplate: |-
        version: 2
        ethernets:
          {{nic 0}}:
            dhcp4: false
            dhcp6: false
            match:
              macaddress: {{mac 0}}
            mtu: 1500
            nameservers:
              addresses: [ 172.18.176.6 ]
            # Name if mandatory
            set-name: "k8s-lcm"
            gateway4: {{ gateway_from_subnet "lcm-nw" }}
            addresses:
              - {{ ip "0:lcm-nw" }}
          {{nic 1}}:
            dhcp4: false
            dhcp6: false
            match:
              macaddress: {{mac 1}}
            set-name: {{nic 1}}
            mtu: 1500
         ....
         ....
    

    Note

    In the previous L2 template format, {{ nic 0}} for the PXE interface was not defined.

After switching to the new l2template format, the following info message appears in the ipamhost status and indicates that bmh successfully migrated to the new format of L2 templates:

KUBECONFIG=kubeconfig kubectl -n managed-ns get ipamhosts
NAME               STATUS                                                                       AGE   REGION
cz7700-bmh         L2Template + L3Layout used, osMetadataNetwork is unacceptable in this mode   49m   region-one