Automate multiple subnet creation using SubnetPool¶
Before creating an L2 template, ensure that you have the required subnets
that can be used in the L2 template to allocate IP addresses for the
managed cluster nodes. You can also create multiple subnets using
SubnetPool object to separate different types of network traffic.
SubnetPool allows for automatic creation of
that will consume blocks from the parent
SubnetPool CIDR IP address
blockSize setting defines the IP address
block size to allocate to each child
SubnetPool has a global
scope, so any
SubnetPool can be used to create the
for any namespace and for any cluster.
To automate multiple subnet creation using SubnetPool:
Log in to a local machine where your management cluster
kubeconfigis located and where
The management cluster
kubeconfigis created during the last stage of the management cluster bootstrap.
subnetpool.yamlfile with a number of subnet pools:
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>
In the command above and in the steps below, substitute the parameters enclosed in angle brackets with the corresponding values.
Example of a
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.
Verify that the subnet pool is successfully created:
kubectl get subnetpool kaas-mgmt -oyaml
In the system output, verify the
statusfields of the
subnetpool.yamlfile. For the status fields description of the
SunbetPoolobject, see SubnetPool status.
Proceed to creating an L2 template for one or multiple managed clusters as described in Create L2 templates. In this procedure, select the exemplary L2 template for multiple subnets that contains the
l3Layoutsection, define all subnets of a cluster. Otherwise, do not use the
l3Layoutsection. Defining only part of subnets is not allowed.