Request a static IP address for a machine
Experimental
Warning
The staticIPRequest option described in this section is under
development and is considered experimental. The API and behavior may change
in future releases. It is intended only for testing and evaluation
purposes on staging clusters. Do not use it for production deployments.
When you create a Machine object, you can request a specific IPv4 address
from a selected cluster subnet using the staticIPRequest field. IPAM
assigns that IP address to the machine instead of allocating the next free IP
address from the subnet range.
The staticIPRequest field is intended only for adding or replacing one
machine at a time. The target use case is the replacement of a single Ceph
Monitor node: OpenStack instances that boot from a Ceph RBD image or volume
store the Ceph Monitor IP addresses and keep using them for as long as the
instance exists.
Note
You can set staticIPRequest only through the management API
or CLI. The MOSK management console does not expose
this field.
Why Ceph Monitor IP addresses must stay stable
Each Ceph Monitor daemon uses a fixed IP address. In production deployments,
that address is defined by the monitorIP value of the corresponding node
in the CephDeployment object and belongs to the Ceph public network. For
details, see Add a Ceph cluster and Nodes parameters.
The OpenStack Compute and Block Storage services pass these Monitor IP addresses to instances that use Ceph RBD, including instances booted from a volume. The IP addresses become part of the instance connection configuration. If you later replace a Monitor node and the new machine receives a different IP address, existing instances keep the old Monitor IP address and lose access to their disks until you reconfigure them.
Requesting the previous Monitor IP address for the new machine avoids that
reconfiguration. After the old machine is deleted and its address is released,
the new machine obtains the same IP address, and you set the same
monitorIP in CephDeployment.
Requirements
The requested address must be unused. Delete the old machine and wait until IPAM releases the address before you create the new machine.
The requested address must belong to the subnet CIDR and to one of the
includeRangesvalues of theSubnetobject. For the range format, see API Reference: Subnet resource.The target subnet must be present in the L2 template that IPAM renders for the machine.
Limitations
IPAM copies
staticIPRequestto the correspondingIpamHostobject only when that object is created. Later edits ofstaticIPRequeston an existingMachineobject have no effect. This behavior matches that ofl2TemplateIfMappingOverride. For details, see Override network interfaces naming and order.If IPAM cannot satisfy the request, machine provisioning does not complete until you correct the request or release the address.
Create and replace only one machine with
staticIPRequestat a time. Do not use this field to add several nodes with static addresses in one operation.
Request a static IP address when creating a machine
Identify the
Subnetobject that must provide the IP address. For a Ceph Monitor, use the subnet of the Ceph public network that you set inpublicNetofCephDeployment.kubectl --kubeconfig <pathToManagementClusterKubeconfig> -n <projectName> get subnet
Verify that the requested IP address is not allocated:
kubectl --kubeconfig <pathToManagementClusterKubeconfig> -n <projectName> get ipaddr -o wide
While creating the
Machineobject as described in Create a machine using CLI, addstaticIPRequesttospec.providerSpec.value. For example:apiVersion: cluster.k8s.io/v1alpha1 kind: Machine metadata: name: <machineName> namespace: <projectName> labels: kaas.mirantis.com/provider: baremetal cluster.sigs.k8s.io/cluster-name: <clusterName> spec: providerSpec: value: apiVersion: baremetal.k8s.io/v1alpha1 kind: BareMetalMachineProviderSpec bareMetalHostProfile: name: <hostProfileName> namespace: <projectName> l2TemplateSelector: name: <l2TemplateName> staticIPRequest: - scope: namespace subnetName: <cephPublicSubnetName> ipaddr: <cephMonitorIP>
For a description of the
staticIPRequestfields, see API Reference: Machine resource.Identify the subnet by name or by labels. Do not mix the two methods in one request item: if
labelSelectoris set, IPAM matches the subnet by labels and ignoressubnetName.Note
You can add several
staticIPRequestlist items to request IP addresses from different subnets.Apply the
Machineobject:kubectl --kubeconfig <pathToManagementClusterKubeconfig> create -f <pathToMachineFile>
Verify that IPAM allocated the requested IP address:
kubectl --kubeconfig <pathToManagementClusterKubeconfig> -n <projectName> get ipaddr -o wide
The
IPaddrobject that belongs to the new machine must contain the requested IP address instatus.
Keep the Ceph Monitor IP address when replacing a node
This procedure follows the standard Monitor migration flow described in Move Ceph Monitor before node replacement, adding the steps that preserve the Ceph Monitor IP address.
To keep the existing Ceph Monitor IP address on a new node:
Capture the current Monitor IP address from
spec.nodesof theCephDeploymentobject. Use themonitorIPvalue of the node that you will replace.kubectl --kubeconfig <pathToMOSKClusterKubeconfig> -n ceph-lcm-mirantis get cephdeployment -o yaml
Move the Ceph Monitor (and Manager, if colocated) off the affected node and delete that node as described in Move Ceph Monitor before node replacement.
Wait until IPAM releases the captured IP address. The address must no longer appear in the
IPaddrlist of the cluster project:kubectl --kubeconfig <pathToManagementClusterKubeconfig> -n <projectName> get ipaddr -o wide
Caution
If the previous Monitor IP address is still allocated, IPAM rejects the static IP request.
Add the new machine with
staticIPRequestset to the captured IP address from the Ceph public network subnet. For the procedure, see Request a static IP address when creating a machine.After the new node is
Ready, set the samemonitorIPon the new node inCephDeploymentand move the Monitor daemon to that node as described in Move a Ceph Monitor daemon to another node.