Mirantis Container Cloud (MCC) becomes part of Mirantis OpenStack for Kubernetes (MOSK)!
Now, 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.
Expand IP addresses capacity in an existing cluster¶
If the subnet capacity on your existing cluster is not enough to add new
machines, use the l2TemplateSelector feature to expand the IP addresses
capacity:
Create new
Subnetobject(s) to define additional address ranges for new machines.Set up routing between the existing and new subnets.
Create new L2 template(s) with the new subnet(s) being used in
l3Layout.Set up
l2TemplateSelectorin theMachineobjects for new machines.
To expand IP addresses capacity for an existing cluster:
Verify the capacity of the subnet(s) currently associated with the L2 template(s) used for cluster deployment:
If
labelSelectoris not used for the given subnet, use thenamespacevalue of the L2 template and thesubnetNamevalue from thel3Layoutsection:kubectl get subnet -n <namespace> <subnetName>
If
labelSelectoris used for the given subnet, use thenamespacevalue of the L2 template and comma-separated key-value pairs from thelabelSelectorsection for the given subnet in thel3Layoutsection:kubectl get subnet -n <namespace> -l <key1=value1>[<,key2=value2>...]
Example command:
kubectl get subnet -n test-ns -l cluster.sigs.k8s.io/cluster-name=mosk123,user-defined/purpose=lcm-base
Example of system response:
NAME AGE CIDR GATEWAY CAPACITY ALLOCATABLE STATUS old-lcm-network 8d 192.168.1.0/24 192.168.1.1 253 0 OK
Existing Subnet example
apiVersion: "ipam.mirantis.com/v1alpha1" kind: Subnet metadata: name: old-lcm-network namespace: test-ns labels: cluster.sigs.k8s.io/cluster-name: mosk123 ipam/SVC-k8s-lcm: "1" kaas.mirantis.com/provider: baremetal user-defined/purpose: lcm-base spec: cidr: 192.168.1.0/24 gateway: 192.168.1.1 . . . status: allocatable: 0 allocatedIPs: . . . capacity: 253 cidr: 192.168.1.0/24 gateway: 192.168.1.1 ranges: - 192.168.1.2-192.168.1.254
Existing L2 template example
apiVersion: ipam.mirantis.com/v1alpha1 kind: L2Template metadata: name: base-template namespace: test-ns labels: ipam/DefaultForCluster: "1" kaas.mirantis.com/provider: baremetal cluster.sigs.k8s.io/cluster-name: mosk123 spec: autoIfMappingPrio: - provision - eno - ens l3Layout: - scope: namespace subnetName: lcm-subnet1 labelSelector: cluster.sigs.k8s.io/cluster-name: mosk123 user-defined/purpose: lcm-base npTemplate: | version: 2 renderer: networkd ethernets: {{nic 0}}: match: macaddress: {{mac 0}} set-name: {{nic 0}} bridges: k8s-lcm: interfaces: - {{nic 0}} addresses: - {{ip "k8s-lcm:lcm-subnet1"}} gateway4: {{gateway_from_subnet "lcm-subnet1"}} nameservers: addresses: {{nameservers_from_subnet "lcm-subnet1"}}
Create new objects:
Subnetwith theuser-defined/purpose: lcm-additionallabel.L2Templatewith thealternative-template: “1”label. The L2 template should reference the newSubnetobject using theuser-defined/purpose: lcm-additionallabel in thelabelSelectorfield.
Note
The label name
user-defined/purposeis used for illustration purposes. Use any custom label name that differs from system names. Use of a unique prefix such asuser-defined/is recommended.New subnet example
apiVersion: "ipam.mirantis.com/v1alpha1" kind: Subnet metadata: name: new-lcm-network namespace: test-ns labels: cluster.sigs.k8s.io/cluster-name: mosk123 ipam/SVC-k8s-lcm: "1" kaas.mirantis.com/provider: baremetal user-defined/purpose: lcm-additional spec: cidr: 192.168.200.0/24 gateway: 192.168.200.1 . . . status: allocatable: 253 allocatedIPs: . . . capacity: 253 cidr: 192.168.200.0/24 gateway: 192.168.200.1 ranges: - 192.168.200.2-192.168.200.254
Alternative L2 template example
apiVersion: ipam.mirantis.com/v1alpha1 kind: L2Template metadata: name: alternative-template namespace: test-ns labels: kaas.mirantis.com/provider: baremetal cluster.sigs.k8s.io/cluster-name: mosk123 alternative-template: “1” spec: autoIfMappingPrio: - provision - eno - ens l3Layout: - scope: namespace subnetName: lcm-subnet2 labelSelector: cluster.sigs.k8s.io/cluster-name: mosk123 user-defined/purpose: lcm-additional npTemplate: | version: 2 renderer: networkd ethernets: {{nic 0}}: match: macaddress: {{mac 0}} set-name: {{nic 0}} bridges: k8s-lcm: interfaces: - {{nic 0}} addresses: - {{ip "k8s-lcm:lcm-subnet2"}} gateway4: {{gateway_from_subnet "lcm-subnet2"}} nameservers: addresses: {{nameservers_from_subnet "lcm-subnet2"}}
You can also reference the new
Subnetobject by using its name in thel3Layoutsection of thealternative-templateL2 template.Snippet example of an alternative L2 template
... spec: ... l3Layout: - scope: namespace subnetName: new-lcm-network ... npTemplate: | ... bridges: k8s-lcm: interfaces: - {{nic 0}} addresses: - {{ip "k8s-lcm:new-lcm-network"}} gateway4: {{gateway_from_subnet "new-lcm-network"}} nameservers: addresses: {{nameservers_from_subnet "new-lcm-network"}}
Set up IP routing between the existing and new subnets using the tools of your cloud network infrastructure.
In the
providerSpecsection of the newMachineobject, define thealternative-templatelabel forl2TemplateSelector:Snippet example of the new Machine object
apiVersion: cluster.k8s.io/v1alpha1 kind: Machine metadata: labels: cluster.sigs.k8s.io/cluster-name: mosk123 kaas.mirantis.com/provider: baremetal name: additional-machine namespace: test-ns spec: ... providerSpec: value: ... l2TemplateSelector: label: alternative-template
After creation, the new machine will use the alternative L2 template that uses the
new-lcm-networksubnet linked byL3Layout.Optional. Configure the additional
extensionIP address pool for themetallbload balancer service.Open the
MetalLBConfigobject of the management cluster for editing:kubectl edit metallbconfig <MetalLBConfigName>
In the
ipAddressPoolssection, add:... spec: ipAddressPools: - name: extension spec: addresses: - <pool_start_ip>-<pool_end_ip> autoAssign: false avoidBuggyIPs: false ...
In the snippet above, replace the following parameters:
<pool_start_ip>- first IP address in the required range<pool_end_ip>- last IP address in the range
Add the
extensionIP address pool name to theL2Advertisementsdefinition. You can add it to the same L2 advertisement as thedefaultIP address pool, or create a new L2 advertisement if required.... spec: l2Advertisements: - name: default spec: interfaces: - k8s-lcm ipAddressPools: - default - extension ...
Save and exit the object to apply changes.
Verify the created objects for MetalLB. For reference, use the
mosk-ns_MetalLBConfig-lb-mosk.yamlfile in Example of a complete template configuration for cluster creation.