Create subnets¶
After creating a basic Cluster object along with
the MetalLBConfig object and before creating an
L2 template, create the required subnets that can be used in the L2 template
to allocate IP addresses for the managed cluster nodes. Where required, create
a number of subnets for a particular project using the Subnet
CR.
Each subnet used in an L2 template has its logical scope that is set using the
scope
parameter in the corresponding L2Template.spec.l3Layout
section.
One of the following logical scopes is used for each subnet referenced in an
L2 template:
global - CR uses the
default
namespace. A subnet can be used for any cluster located in any project.namespaced - CR uses the namespace that corresponds to a particular project where managed clusters are located. A subnet can be used for any cluster located in the same project.
cluster - Deprecated since Container Cloud 2.27.0 (Cluster releases 17.2.0 and 16.2.0). CR uses the namespace where the referenced cluster is located. A subnet is only accessible to the cluster that
L2Template.metadata.labels:cluster.sigs.k8s.io/cluster-name
(mandatory since 2.25.0) orL2Template.spec.clusterRef
(deprecated since 2.25.0) refers to. TheSubnet
objects with thecluster
scope will be created for every new cluster depending on the providedSubnetPool
.
Note
The use of the ipam/SVC-MetalLB
label in Subnet
objects
is deprecated as part of the MetalLBConfigTemplate
object deprecation
in Container Cloud 2.27.0 (Cluster releases 17.2.0 and 16.2.0). No
actions are required for existing objects. A Subnet
object containing
this label will be ignored by baremetal-provider
after cluster update
to the mentioned Cluster releases.
You can have subnets with the same name in different projects. In this case, the subnet that has the same project as the cluster will be used. One L2 template may often reference several subnets, those subnets may have different scopes in this case.
The IP address objects (IPaddr
CR) that are allocated from subnets
always have the same project as their corresponding IpamHost
objects,
regardless of the subnet scope.
You can create subnets using either the Container Cloud web UI or CLI.