Subnet¶
This section describes the Subnet
resource used in Mirantis
Container Cloud API to allocate IP addresses for the cluster nodes.
For demonstration purposes, the Container Cloud Subnet
custom resource (CR) can be split into the following major sections:
Subnet metadata¶
The Container Cloud Subnet
CR contains the following fields:
apiVersion
API version of the object that is
ipam.mirantis.com/v1alpha1
.
kind
Object type that is
Subnet
metadata
This field contains the following subfields:
name
Name of the
Subnet
object.
namespace
Project in which the
Subnet
object was created.
labels
Key-value pairs that are attached to the object:
ipam/DefaultSubnet: "1"
Deprecated since 2.14.0Indicates that this subnet was automatically created for the PXE network.
ipam/UID
Unique ID of a subnet.
kaas.mirantis.com/provider
Provider type.
kaas.mirantis.com/region
Region name.
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.
Warning
Labels and annotations that are not documented in this API Reference are generated automatically by Container Cloud. Do not modify them using the Container Cloud API.
Configuration example:
apiVersion: ipam.mirantis.com/v1alpha1
kind: Subnet
metadata:
name: kaas-mgmt
namespace: default
labels:
ipam/UID: 1bae269c-c507-4404-b534-2c135edaebf5
kaas.mirantis.com/provider: baremetal
Subnet spec¶
The spec
field of the Subnet
resource describes the desired state of
a subnet. It contains the following fields:
cidr
A valid IPv4 CIDR, for example,
10.11.0.0/24
.
gateway
A valid gateway address, for example,
10.11.0.9
.
includeRanges
A comma-separated list of IP address ranges within the given CIDR that should be used in the allocation of IPs for nodes. The gateway, network, broadcast, and DNSaddresses will be excluded (protected) automatically if they intersect with one of the range. The IPs outside the given ranges will not be used in the allocation. Each element of the list can be either an interval
10.11.0.5-10.11.0.70
or a single address10.11.0.77
. TheincludeRanges
parameter is mutually exclusive withexcludeRanges
.
excludeRanges
A comma-separated list of IP address ranges within the given CIDR that should not be used in the allocation of IPs for nodes. The IPs within the given CIDR but outside the given ranges will be used in the allocation. The gateway, network, broadcast, and DNS addresses will be excluded (protected) automatically if they are included in the CIDR. Each element of the list can be either an interval
10.11.0.5-10.11.0.70
or a single address10.11.0.77
. TheexcludeRanges
parameter is mutually exclusive withincludeRanges
.
useWholeCidr
If set to
false
(by default), the subnet address and broadcast address will be excluded from the address allocation. If set totrue
, the subnet address and the broadcast address are included into the address allocation for nodes.
nameservers
The list of IP addresses of name servers. Each element of the list is a single address, for example,
172.18.176.6
.
Configuration example:
spec:
cidr: 172.16.48.0/24
excludeRanges:
- 172.16.48.99
- 172.16.48.101-172.16.48.145
gateway: 172.16.48.1
nameservers:
- 172.18.176.6
Subnet status¶
The status
field of the Subnet
resource describes the actual state of
a subnet. It contains the following fields:
allocatable
The number of IP addresses that are available for allocation.
allocatedIPs
The list of allocated IP addresses in the
IP:<IPAddr object UID>
format.
capacity
The total number of IP addresses to be allocated, including the sum of allocatable and already allocated IP addresses.
cidr
The IPv4 CIDR for a subnet.
gateway
The gateway address for a subnet.
nameservers
The list of IP addresses of name servers.
ranges
The list of IP address ranges within the given CIDR that are used in the allocation of IPs for nodes.
statusMessage
Deprecated since Container Cloud 2.23.0 and will be removed in one of the following releases in favor of
state
andmessages
. Since Container Cloud 2.24.0, this field is not set for the subnets of newly created clusters. For the field description, seestate
.
state
Since 2.23.0Message that reflects the current status of the resource. The list of possible values includes the following:
OK
- object is operational.ERR
- object is non-operational. This status has a detailed description in themessages
list.TERM
- object was deleted and is terminating.
messages
Since 2.23.0List of error or warning messages if the object state is
ERR
.
objCreated
Date, time, and IPAM version of the resource creation.
objStatusUpdated
Date, time, and IPAM version of the last update of the
status
field in the resource.
objUpdated
Date, time, and IPAM version of the last resource update.
Configuration example:
status:
allocatable: 51
allocatedIPs:
- 172.16.48.200:24e94698-f726-11ea-a717-0242c0a85b02
- 172.16.48.201:2bb62373-f726-11ea-a717-0242c0a85b02
- 172.16.48.202:37806659-f726-11ea-a717-0242c0a85b02
capacity: 54
cidr: 172.16.48.0/24
gateway: 172.16.48.1
nameservers:
- 172.18.176.6
ranges:
- 172.16.48.200-172.16.48.253
objCreated: 2021-10-21T19:09:32Z by v5.1.0-20210930-121522-f5b2af8
objStatusUpdated: 2021-10-21T19:14:18.748114886Z by v5.1.0-20210930-121522-f5b2af8
objUpdated: 2021-10-21T19:09:32.606968024Z by v5.1.0-20210930-121522-f5b2af8
state: OK