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.
MetalLBConfig¶
GA since MCC 2.24.0 (14.0.0) for management clusters GA and mandatory for any cluster type after a management cluster upgrade to MCC 2.25.0 (16.0.0)
This section describes the MetalLBConfig custom resource used in the
management API that contains the MetalLB configuration objects for a particular
cluster.
For demonstration purposes, the MetalLBConfig custom resource description
is split into the following major sections:
The management API also uses the third-party open-source MetalLB API. For details, see MetalLB objects.
MetalLBConfig metadata¶
The MetalLBConfig CR contains the following general fields:
apiVersionAPI version of the object that is
kaas.mirantis.com/v1alpha1.
kindObject type that is
MetalLBConfig.
The metadata object field of the MetalLBConfig resource
contains the following fields:
nameName of the
MetalLBConfigobject.
namespaceProject in which the object was created. Must match the project name of the target cluster.
labelsKey-value pairs attached to the object. Mandatory labels:
kaas.mirantis.com/providerProvider type that is
baremetal.
kaas.mirantis.com/regionRegion name that matches the region name of the target cluster.
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.
cluster.sigs.k8s.io/cluster-nameName of the cluster that the MetalLB configuration must apply to.
Warning
Labels and annotations that are not documented in this API Reference are generated automatically. Do not modify them using the API.
Configuration example:
apiVersion: kaas.mirantis.com/v1alpha1
kind: MetalLBConfig
metadata:
name: metallb-demo
namespace: test-ns
labels:
kaas.mirantis.com/provider: baremetal
cluster.sigs.k8s.io/cluster-name: test-cluster
MetalLBConfig spec¶
The spec field of the MetalLBConfig object represents the
MetalLBConfigSpec subresource that contains the description of MetalLB
configuration objects.
These objects are created in the target cluster during its deployment.
The spec field contains the following optional fields:
addressPoolsRemoved in Container Cloud 2.27.0 (Cluster releases 17.2.0 and 16.2.0), deprecated in 2.26.0 (Cluster releases 17.2.0 and 16.2.0).
List of
MetalLBAddressPoolobjects to create MetalLBAddressPoolobjects.
bfdProfilesList of
MetalLBBFDProfileobjects to create MetalLBBFDProfileobjects.
bgpAdvertisementsList of
MetalLBBGPAdvertisementobjects to create MetalLBBGPAdvertisementobjects.
bgpPeersList of
MetalLBBGPPeerobjects to create MetalLBBGPPeerobjects.
communitiesList of
MetalLBCommunityobjects to create MetalLBCommunityobjects.
ipAddressPoolsList of
MetalLBIPAddressPoolobjects to create MetalLBIPAddressPoolobjects.
l2AdvertisementsList of
MetalLBL2Advertisementobjects to create MetalLBL2Advertisementobjects.The
l2Advertisementsobject allows defining interfaces to optimize the announcement. When you use theinterfacesselector, LB addresses are announced only on selected host interfaces.Mirantis recommends using the
interfacesselector if nodes use separate host networks for different types of traffic. The pros of such configuration are as follows: less spam on other interfaces and networks and limited chances to reach IP addresses of load-balanced services from irrelevant interfaces and networks.Caution
Interface names in the
interfaceslist must match those on the corresponding nodes.
templateNameUnsupported since Container Cloud 2.28.0 (17.3.0 and 16.3.0). For details, see Deprecation notes.
Name of the
MetalLBConfigTemplateobject used as a source of MetalLB configuration objects. Mutually exclusive with the fields listed below that will be part of theMetalLBConfigTemplateobject. For details, see MetalLBConfigTemplate.Before Cluster releases 17.2.0 and 16.2.0,
MetalLBConfigTemplateis the default configuration method for MetalLB. Since Cluster releases 17.2.0 and 16.2.0, use theMetalLBConfigobject instead.
The objects listed in the spec field of the MetalLBConfig object, such
as MetalLBIPAddressPool, MetalLBL2Advertisement, and so on, are used as
templates for the MetalLB objects that will be created in the target cluster.
Each of these objects has the following structure:
labelsOptional. Key-value pairs attached to the
metallb.io/<objectName>object asmetadata.labels.
nameName of the
metallb.io/<objectName>object.
specContents of the
specsection of themetallb.io/<objectName>object. Thespecfield has themetallb.io/<objectName>Spectype. For details, see MetalLB objects.
For example, MetalLBIPAddressPool is a template for the
metallb.io/IPAddressPool object and has the following structure:
labelsOptional. Key-value pairs attached to the
metallb.io/IPAddressPoolobject asmetadata.labels.
nameName of the
metallb.io/IPAddressPoolobject.
specContents of the
specsection of themetallb.io/IPAddressPoolobject. Thespechas themetallb.io/IPAddressPoolSpectype.
MetalLB objects¶
MOSK supports the following MetalLB object types of the
metallb.io API group:
|
|
As of v1beta1 and v1beta2 API versions, metadata of MetalLB objects
has a standard format with no specific fields or labels defined for any
particular object:
apiVersionAPI version of the object that can be
metallb.io/v1beta1ormetallb.io/v1beta2.
kindObject type that is one of the
metallb.iotypes listed above. For example,IPAddressPool.
metadataObject metadata that contains the following subfields:
nameName of the object.
namespaceNamespace where the MetalLB components are located. It matches
metallb-systemin MOSK.
labelsOptional. Key-value pairs that are attached to the object. It can be an arbitrary set of labels. No special labels are defined as of
v1beta1andv1beta2API versions.
The MetalLBConfig object contains spec sections of the
metallb.io/<objectName> objects that have the
metallb.io/<objectName>Spec type. For metallb.io/<objectName> and
metallb.io/<objectName>Spec types definitions, refer to the official
MetalLB documentation:
Note
Before Container Cloud 2.27.0 (Cluster releases 17.2.0 and 16.2.0),
metallb.io/<objectName> objects v0.13.9 are supported.
The l2Advertisements object allows defining interfaces to optimize
the announcement. When you use the interfaces selector, LB addresses
are announced only on selected host interfaces. Mirantis recommends this
configuration if nodes use separate host networks for different types
of traffic. The pros of such configuration are as follows: less spam on
other interfaces and networks, limited chances to reach services
LB addresses from irrelevant interfaces and networks.
Configuration example:
l2Advertisements: |
- name: management-lcm
spec:
ipAddressPools:
- default
interfaces:
# LB addresses from the "default" address pool will be announced
# on the "k8s-lcm" interface
- k8s-lcm
Caution
Interface names in the interfaces list must match those
on the corresponding nodes.
MetalLBConfig status¶
Available since MCC 2.24.0 (14.0.0) for management clusters
Caution
For MOSK clusters, this field is generally available since 23.3.
The status field describes the actual state of the object.иIt contains
the following fields:
bootstrapModeOnly in MCC 2.24.0Field that appears only during a management cluster bootstrap as
trueand is used internally for bootstrap. Once deployment completes, the value is moved tofalseand is excluded from thestatusoutput.
objectsDescription of MetalLB objects that is used to create MetalLB native objects in the target cluster.
The format of underlying objects is the same as for those in the
specfield, excepttemplateName, which is obsolete since Container Cloud 2.28.0 (Cluster releases 17.3.0 and 16.3.0) and which is not present in this field. Theobjectscontents are rendered from the following locations, with possible modifications for the bootstrap cluster:Since Container Cloud 2.28.0 (Cluster releases 17.3.0 and 16.3.0):
MetalLBConfig.specBefore Container Cloud 2.28.0 (Cluster releases 17.2.0, 16.2.0, or earlier):
MetalLBConfigTemplate.statusof the corresponding template ifMetalLBConfig.spec.templateNameis definedMetalLBConfig.specifMetalLBConfig.spec.templateNameis not defined
propagateResultResult of objects propagation. During objects propagation, native MetalLB objects of the target cluster are created and updated according to the description of the objects present in the
status.objectsfield.This field contains the following information:
messageText message that describes the result of the last attempt of objects propagation. Contains an error message if the last attempt was unsuccessful.
successResult of the last attempt of objects propagation. Boolean.
timeTimestamp of the last attempt of objects propagation. For example,
2023-07-04T00:30:36Z.
If the objects propagation was successful, the MetalLB objects of the target cluster match the ones present in the
status.objectsfield.
updateResultStatus of the MetalLB objects update. Has the same format of subfields that in
propagateResultdescribed above.During objects update, the
status.objectscontents are rendered as described in theobjectsfield definition above.If the objects update was successful, the MetalLB objects description present in
status.objectsis rendered successfully and up to date. This description is used to update MetalLB objects in the target cluster. If the objects update was not successful, MetalLB objects will not be propagated to the target cluster.
MetalLB configuration examples¶
Example of configuration template for using L2 announcements:
apiVersion: kaas.mirantis.com/v1alpha1
kind: MetalLBConfig
metadata:
labels:
cluster.sigs.k8s.io/cluster-name: demo-cluster
kaas.mirantis.com/provider: baremetal
name: demo-cluster-l2
namespace: demo-ns
spec:
ipAddressPools:
- name: services
spec:
addresses:
- 10.100.91.151-10.100.91.170
autoAssign: true
avoidBuggyIPs: false
l2Advertisements:
- name: services
spec:
ipAddressPools:
- services
Example of configuration extract for using the interfaces selector, which
enables announcement of LB addresses only on selected host interfaces:
l2Advertisements:
- name: services
spec:
ipAddressPools:
- default
interfaces:
- k8s-lcm
Caution
Interface names in the interfaces list must match the ones
on the corresponding nodes.
After the object is created and processed by the MetalLB Controller, the
status field is added. For example:
status:
objects:
ipAddressPools:
- name: services
spec:
addresses:
- 10.100.100.151-10.100.100.170
autoAssign: true
avoidBuggyIPs: false
l2Advertisements:
- name: services
spec:
ipAddressPools:
- services
propagateResult:
message: Objects were successfully updated
success: true
time: "2023-07-04T14:31:40Z"
updateResult:
message: Objects were successfully read from MetalLB configuration specification
success: true
time: "2023-07-04T14:31:39Z"
Example of native MetalLB objects to be created in the demo-ns/demo-cluster
cluster during deployment:
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: services
namespace: metallb-system
spec:
addresses:
- 10.100.91.151-10.100.91.170
autoAssign: true
avoidBuggyIPs: false
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: services
namespace: metallb-system
spec:
ipAddressPools:
- services
Example of configuration template for using BGP announcements:
apiVersion: kaas.mirantis.com/v1alpha1
kind: MetalLBConfig
metadata:
labels:
cluster.sigs.k8s.io/cluster-name: demo-cluster
kaas.mirantis.com/provider: baremetal
name: demo-cluster-bgp
namespace: demo-ns
spec:
bgpPeers:
- name: bgp-peer-rack1
spec:
peerAddress: 10.0.41.1
peerASN: 65013
myASN: 65099
nodeSelectors:
- matchLabels:
rack-id: rack1
- name: bgp-peer-rack2
spec:
peerAddress: 10.0.42.1
peerASN: 65023
myASN: 65099
nodeSelectors:
- matchLabels:
rack-id: rack2
- name: bgp-peer-rack3
spec:
peerAddress: 10.0.43.1
peerASN: 65033
myASN: 65099
nodeSelectors:
- matchLabels:
rack-id: rack3
ipAddressPools:
- name: services
spec:
addresses:
- 10.100.191.151-10.100.191.170
autoAssign: true
avoidBuggyIPs: false
bgpAdvertisements:
- name: services
spec:
ipAddressPools:
- services