Mirantis Container Cloud (MCC) becomes part of Mirantis OpenStack for Kubernetes (MOSK)!
Starting with MOSK 25.2, the MOSK documentation set covers all product layers, including MOSK management (formerly Container Cloud). This means everything you need is in one place. Some legacy names may remain in the code and documentation and will be updated in future releases. The separate Container Cloud documentation site will be retired, so please update your bookmarks for continued easy access to the latest content.
Automate multiple subnet creation using SubnetPool¶
Unsupported since MCC 2.28.0 (17.3.0 and 16.3.0)
Warning
The SubnetPool object is unsupported since Container Cloud
2.28.0 (Cluster releases 17.3.0 and 16.3.0). For details, see
Deprecation Notes: SubnetPool resource management.
Operators of MOSK for on-demand self-service Kubernetes deployments will want their users to create networks without extensive knowledge about network topology or IP addresses. For that purpose, the operator can prepare L2 network templates in advance for users to assign these templates to machines in their clusters.
The operator can ensure that the users’ clusters have separate
IP address spaces using the SubnetPool resource.
SubnetPool allows for automatic creation of Subnet objects
that will consume blocks from the parent SubnetPool CIDR IP address
range. The SubnetPool blockSize setting defines the IP address
block size to allocate to each child Subnet. SubnetPool has a global
scope, so any SubnetPool can be used to create the Subnet objects
for any namespace and for any cluster.
You can use the SubnetPool resource in the L2Template resources to
automatically allocate IP addresses from an appropriate IP range that
corresponds to a specific cluster, or create a Subnet resource
if it does not exist yet. This way, every cluster will use subnets
that do not overlap with other clusters.
To automate multiple subnet creation using SubnetPool:
Log in to a local machine where your management cluster
kubeconfigis located and wherekubectlis installed.Note
The management cluster
kubeconfigis created during the last stage of the management cluster bootstrap.Create the
subnetpool.yamlfile with a number of subnet pools:Note
You can define either or both subnets and subnet pools, depending on the use case. A single L2 template can use either or both subnets and subnet pools.
kubectl --kubeconfig <pathToManagementClusterKubeconfig> apply -f <SubnetFileName.yaml>
Note
In the command above and in the steps below, substitute the parameters enclosed in angle brackets with the corresponding values.
Example of a
subnetpool.yamlfile:apiVersion: ipam.mirantis.com/v1alpha1 kind: SubnetPool metadata: name: kaas-mgmt namespace: default labels: kaas.mirantis.com/provider: baremetal kaas.mirantis.com/region: region-one spec: cidr: 10.10.0.0/16 blockSize: /25 nameservers: - 172.18.176.6 gatewayPolicy: first
For the specification fields description of the
SubnetPoolobject, see SubnetPool spec.Note
The
kaas.mirantis.com/regionlabel 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.Verify that the subnet pool is successfully created:
kubectl get subnetpool kaas-mgmt -oyaml
In the system output, verify the
statusfields of thesubnetpool.yamlfile. For the status fields description of theSunbetPoolobject, see SubnetPool status.Proceed to creating an L2 template for one or multiple MOSK clusters as described in Create L2 templates. In this procedure, select the exemplary L2 template for multiple subnets.
Caution
Using the
l3Layoutsection, define all subnets that are used in thenpTemplatesection. Defining only part of subnets is not allowed.If
labelSelectoris used inl3Layout, use any custom label name that differs from system names. This allows for easier cluster scaling in case of adding new subnets as described in Expand IP addresses capacity in an existing cluster.Mirantis recommends using a unique label prefix such as
user-defined/.