MachinePool resource¶
Note
The feature does not apply to the bare metal provider.
This section describes the MachinePool
resource used in the Container
Cloud API for all types of supported cloud providers.
The MachinePool
resource describes the parameters of a machine pool
and machines assigned to it.
For demonstration purposes, the Container Cloud MachinePool
custom resource (CR) can be split into the following major sections:
metadata¶
The Container Cloud MachinePool
custom resource (CR) contains the following
fields:
apiVersion
Object API version that is
kaas.mirantis.com/v1alpha1
.
kind
Object type that is
MachinePool
.
The metadata
object field of the MachinePool
resource contains
the following fields:
name
Name of the
MachinePool
object.
namespace
Container Cloud project in which the
MachinePool
object has been created. Any machine assigned to this machine pool will be created in the same project.
labels
Key-value pairs attached to the object:
kaas.mirantis.com/provider
Provider type that matches the provider type in the
Cluster
object.
kaas.mirantis.com/region
Region name that matches the region name in the
Cluster
object.Note
The
kaas.mirantis.com/region
label is removed from all Container Cloud objects in 2.26.0 (Cluster releases 17.1.0 and 16.1.0). Therefore, do not add the label starting these releases. On existing clusters updated to these releases, or if manually added, this label will be ignored by Container Cloud.
cluster.sigs.k8s.io/cluster-name
Cluster name that this machine pool is linked to.
cluster.sigs.k8s.io/control-plane
For the control plane role of machines assigned to the machine pool, this label contains any value, for example,
"true"
.For the worker role, this label is absent.
Machines assigned to a machine pool have the same
labels
as their machine pool.
Configuration example:
apiVersion: kaas.mirantis.com/v1alpha1
kind: MachinePool
metadata:
name: example-control-plane
namespace: example-ns
labels:
kaas.mirantis.com/provider: openstack
cluster.sigs.k8s.io/cluster-name: example-cluster
cluster.sigs.k8s.io/control-plane: "true" # remove for pool of workers
MachinePool spec¶
The spec
field of the MachinePool
object contains the following fields:
deletePolicy
Policy used to identify nodes for deletion when downscaling. Defaults to
never
, which is currently the only supported value.
replicas
Required number of machines assigned to the machine pool.
Caution
Manually decrease replicas count when you unassign a machine from a pool with positive replicas count using the Container Cloud API.
If you decrease the replicas count, extra machines are not deleted automatically. Therefore, manually delete extra machines from the pool to match the decreased replicas count.
Deleting a machine assigned to a pool without decreasing replicas count causes automatic machine recreation.
If you increase the replicas count, additional machines are created automatically.
machineSpec
Value used to fill the
spec
field of machines created for the machine pool. The field is provider-specific, for details see theMachine
object API documentation of a particular provider.Caution
Changing
machineSpec
of theMachinePool
object causes the corresponding change in the spec of every machine assigned to the pool. Therefore, edit it with caution.
Configuration example (OpenStack):
spec:
deletePolicy: never
replicas: 3
machineSpec: #here goes example spec for an OpenStack machine
providerSpec:
value:
apiVersion: openstackproviderconfig.k8s.io/v1alpha1
kind: OpenstackMachineProviderSpec
availabilityZone: nova
flavor: kaas.small
image: jammy-server-cloudimg-amd64-20240823
securityGroups:
- kaas-sg-ctrl-abcdefgh-0123-4567-890a-0a1b2c3d4e5f
- kaas-sg-glob-abcdefgh-0123-4567-890a-0a1b2c3d4e5f
nodeLabels:
- displayName: Stacklight
key: stacklight
value: enabled
MachinePool status¶
The status
field of the MachinePool
object contains the following
fields:
replicas
Most recent observed number of machines assigned to the machine pool.
readyReplicas
Number of ready machines assigned to the machine pool.
Configuration example:
status:
readyReplicas: 3
replicas: 3