Cluster Network Operator in OpenShift Container Platform
With the Cluster Network Operator, you can manage networking in OpenShift Container Platform, including how to view status, enable IP forwarding, and collect logs.
You can use the Cluster Network Operator (CNO) to deploy and manage cluster network components on an OpenShift Container Platform cluster, including the Container Network Interface (CNI) network plugin selected for the cluster during installation.
Cluster Network Operator
The Cluster Network Operator implements the network API from the operator.openshift.io API group. The Operator deploys the OVN-Kubernetes network plugin, or the network provider plugin that you selected during cluster installation, by using a daemon set.
The Cluster Network Operator is deployed during installation as a Kubernetes Deployment.
Procedure
- Run the following command to view the Deployment status:terminal
$ oc get -n openshift-network-operator deployment/network-operatorExample outputNAME READY UP-TO-DATE AVAILABLE AGE network-operator 1/1 1 1 56m - Run the following command to view the state of the Cluster Network Operator:terminal
$ oc get clusteroperator/networkExample outputNAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE network 4.16.1 True False False 50mThe following fields provide information about the status of the operator:
AVAILABLE,PROGRESSING, andDEGRADED. TheAVAILABLEfield isTruewhen the Cluster Network Operator reports an available status condition.
Viewing the cluster network configuration
You can view your OpenShift Container Platform cluster network configuration by using the oc describe command for the network.config/cluster resource.
Procedure
- Use the
oc describecommand to view the cluster network configuration:terminal$ oc describe network.config/clusterExample outputName: cluster Namespace: Labels: <none> Annotations: <none> API Version: config.openshift.io/v1 Kind: Network Metadata: Creation Timestamp: 2024-08-08T11:25:56Z Generation: 3 Resource Version: 29821 UID: 808dd2be-5077-4ff7-b6bb-21b7110126c7 Spec: Cluster Network: Cidr: 10.128.0.0/14 Host Prefix: 23 External IP: Policy: Network Diagnostics: Mode: Source Placement: Target Placement: Network Type: OVNKubernetes Service Network: 172.30.0.0/16 Status Cluster Network: Cidr: 10.128.0.0/14 Host Prefix: 23 Cluster Network MTU: 1360 Conditions: Last Transition Time: 2024-08-08T11:51:50Z Message: Observed Generation: 0 Reason: AsExpected Status: True Type: NetworkDiagnosticsAvailable Network Type: OVNKubernetes Service Network: 172.30.0.0/16 Events: <none>where:
specSpecifies the field that displays the configured state of the cluster network.
StatusDisplays the current state of the cluster network configuration.
Viewing Cluster Network Operator status
You can inspect the status and view the details of the Cluster Network Operator by using the oc describe command.
Procedure
- Run the following command to view the status of the Cluster Network Operator:terminal
$ oc describe clusteroperators/network
Enabling IP forwarding globally
From OpenShift Container Platform 4.14 onward, OVN-Kubernetes disables global IP forwarding by default. By setting the Cluster Network Operator gatewayConfig.ipForwarding spec to Global, you can enable cluster-wide forwarding.
Procedure
- Backup the existing network configuration by running the following command:terminal
$ oc get network.operator cluster -o yaml > network-config-backup.yaml - Run the following command to modify the existing network configuration:terminal
$ oc edit network.operator cluster- Add or update the following block under
specas illustrated in the following example:yamlspec: clusterNetwork: - cidr: 10.128.0.0/14 hostPrefix: 23 serviceNetwork: - 172.30.0.0/16 networkType: OVNKubernetes clusterNetworkMTU: 8900 defaultNetwork: ovnKubernetesConfig: gatewayConfig: ipForwarding: Global - Save and close the file.
- Add or update the following block under
- After applying the changes, the OpenShift Cluster Network Operator (CNO) applies the update across the cluster. You can monitor the progress by using the following command:terminal
$ oc get clusteroperators networkThe status should eventually report as
Available,Progressing=False, andDegraded=False. - Alternatively, you can enable IP forwarding globally by running the following command:terminal
$ oc patch network.operator cluster -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}' --type=mergeNoteThe other valid option for this parameter is
Restrictedin case you want to revert this change.Restrictedis the default and with that setting global IP address forwarding is disabled.
Viewing Cluster Network Operator logs
You can view Cluster Network Operator logs by using the oc logs command.
Procedure
- Run the following command to view the logs of the Cluster Network Operator:terminal
$ oc logs --namespace=openshift-network-operator deployment/network-operator
Cluster Network Operator configuration
To manage cluster networking, configure the Cluster Network Operator (CNO) Network custom resource (CR) named cluster so the cluster uses the correct IP ranges and network plugin settings for reliable pod and service connectivity. Some settings and fields are inherited at the time of install or by the default.Network.type plugin, OVN-Kubernetes.
The CNO configuration inherits the following fields during cluster installation from the Network API in the Network.config.openshift.io API group:
clusterNetworkIP address pools from which pod IP addresses are allocated.
serviceNetworkIP address pool for services.
defaultNetwork.typeCluster network plugin.
OVNKubernetesis the only supported plugin during installation.
After cluster installation, you can only modify the clusterNetwork IP address range. The serviceNetwork range cannot be modified post-installation, either directly or by using the ServiceCIDR API.
You can specify the cluster network plugin configuration for your cluster by setting the fields for the defaultNetwork object in the CNO object named cluster.
Cluster Network Operator configuration object
The fields for the Cluster Network Operator (CNO) are described in the following table:
Cluster Network Operator configuration object
| Field | Type | Description |
|---|---|---|
metadata.name |
string |
The name of the CNO object. This name is always cluster. |
spec.clusterNetwork |
array |
A list specifying the blocks of IP addresses from which pod IP addresses are allocated and the subnet prefix length assigned to each individual node in the cluster. If you use dual-stack networking, specify IPv4 and IPv6 address families. For example:spec:
clusterNetwork:
- cidr: 10.128.0.0/19
hostPrefix: 23
- cidr: fd01::/48
hostPrefix: 64If you install a cluster on AWS with dual-stack networking, the order of addresses must match the dual-stack configuration you selected. For example, if you specified the DualStackIPv4Primary, list the IPv4 address first. |
spec.serviceNetwork |
array |
A block of IP addresses for services. If you use dual-stack networking, specify IPv4 and IPv6 address families. For example:spec: serviceNetwork: - 172.30.0.0/14 - fd02::/112 If you install a cluster on AWS with dual-stack networking, the order of addresses must match the dual-stack configuration you selected. For example, if you specified the DualStackIPv4Primary, list the IPv4 address first.This value is ready-only and inherited from the Network.config.openshift.io object named cluster during cluster installation. |
spec.defaultNetwork |
object |
Configures the network plugin for the cluster network. |
spec.additionalRoutingCapabilities.providers |
array |
This setting enables a dynamic routing provider. The FRR routing capability provider is required for the route advertisement feature. The only supported value is FRR.
spec:
additionalRoutingCapabilities:
providers:
- FRR |
For a cluster that needs to deploy objects across multiple networks, ensure that you specify the same value for the clusterNetwork.hostPrefix parameter for each network type that is defined in the install-config.yaml file. Setting a different value for each clusterNetwork.hostPrefix parameter can impact the OVN-Kubernetes network plugin, where the plugin cannot effectively route object traffic among different nodes.
defaultNetwork object configuration
The values for the defaultNetwork object are defined in the following table:
defaultNetwork object
| Field | Type | Description |
|---|---|---|
type |
string |
OVNKubernetes. The Red Hat OpenShift Networking network plugin is selected during installation. This value cannot be changed after cluster installation.
|
ovnKubernetesConfig |
object |
This object is only valid for the OVN-Kubernetes network plugin. |
Configuration for the OVN-Kubernetes network plugin
The following table describes the configuration fields for the OVN-Kubernetes network plugin:
ovnKubernetesConfig object
| Field | Type | Description |
|---|---|---|
mtu |
integer |
The maximum transmission unit (MTU) for the Geneve (Generic Network Virtualization Encapsulation) overlay network. This value is normally configured automatically. |
genevePort |
integer |
The UDP port for the Geneve overlay network. |
ipsecConfig |
object |
An object describing the IPsec mode for the cluster. |
ipv4 |
object |
Specifies a configuration object for IPv4 settings. |
ipv6 |
object |
Specifies a configuration object for IPv6 settings. |
policyAuditConfig |
object |
Specify a configuration object for customizing network policy audit logging. If unset, the defaults audit log settings are used. |
routeAdvertisements |
string |
Specifies whether to advertise cluster network routes. The default value is Disabled.
|
gatewayConfig |
object |
Optional: Specify a configuration object for customizing how egress traffic is sent to the node gateway. Valid values are Shared and Local. The default value is Shared. In the default setting, the Open vSwitch (OVS) outputs traffic directly to the node IP interface. If you are using hardware offloading, Red Hat recommends to use the default Shared gateway mode to bypass the host routing plane. In the Local setting, it traverses the host network; consequently, it gets applied to the routing table of the host.
|
ovnKubernetesConfig.ipv4 object
| Field | Type | Description |
|---|---|---|
internalTransitSwitchSubnet |
string | If your existing network infrastructure overlaps with the 100.88.0.0/16 IPv4 subnet, you can specify a different IP address range for internal use by OVN-Kubernetes. The subnet for the distributed transit switch that enables east-west traffic. This subnet cannot overlap with any other subnets used by OVN-Kubernetes or on the host itself. It must be large enough to accommodate one IP address per node in your cluster.The default value is 100.88.0.0/16. |
internalJoinSubnet |
string | If your existing network infrastructure overlaps with the 100.64.0.0/16 IPv4 subnet, you can specify a different IP address range for internal use by OVN-Kubernetes. You must ensure that the IP address range does not overlap with any other subnet used by your OpenShift Container Platform installation. The IP address range must be larger than the maximum number of nodes that can be added to the cluster. For example, if the clusterNetwork.cidr value is 10.128.0.0/14 and the clusterNetwork.hostPrefix value is /23, then the maximum number of nodes is 2^(23-14)=512.The default value is 100.64.0.0/16. |
ovnKubernetesConfig.ipv6 object
| Field | Type | Description |
|---|---|---|
internalTransitSwitchSubnet |
string | If your existing network infrastructure overlaps with the fd97::/64 IPv6 subnet, you can specify a different IP address range for internal use by OVN-Kubernetes. The subnet for the distributed transit switch that enables east-west traffic. This subnet cannot overlap with any other subnets used by OVN-Kubernetes or on the host itself. It must be large enough to accommodate one IP address per node in your cluster.The default value is fd97::/64. |
internalJoinSubnet |
string | If your existing network infrastructure overlaps with the fd98::/64 IPv6 subnet, you can specify a different IP address range for internal use by OVN-Kubernetes. You must ensure that the IP address range does not overlap with any other subnet used by your OpenShift Container Platform installation. The IP address range must be larger than the maximum number of nodes that can be added to the cluster.The default value is fd98::/64. |
policyAuditConfig object
| Field | Type | Description |
|---|---|---|
rateLimit |
integer | The maximum number of messages to generate every second per node. The default value is 20 messages per second. |
maxFileSize |
integer | The maximum size for the audit log in bytes. The default value is 50000000 or 50 MB. |
maxLogFiles |
integer | The maximum number of log files that are retained. |
destination |
string | One of the following additional audit log targets:
|
syslogFacility |
string | The syslog facility, such as kern, as defined by RFC5424. The default value is local0. |
gatewayConfig object
| Field | Type | Description |
|---|---|---|
routingViaHost |
boolean |
Set this field to true to send egress traffic from pods to the host networking stack. For highly-specialized installations and applications that rely on manually configured routes in the kernel routing table, you might want to route egress traffic to the host networking stack. By default, egress traffic is processed in OVN to exit the cluster and is not affected by specialized routes in the kernel routing table. The default value is false.This field has an interaction with the Open vSwitch hardware offloading feature. If you set this field to true, you do not receive the performance benefits of the offloading because egress traffic is processed by the host networking stack. |
ipForwarding |
object |
You can control IP forwarding for all traffic on OVN-Kubernetes managed interfaces by using the ipForwarding specification in the Network resource. Specify Restricted to only allow IP forwarding for Kubernetes related traffic. Specify Global to allow forwarding of all IP traffic. For new installations, the default is Restricted. For updates to OpenShift Container Platform 4.14 or later, the default is Global.
|
ipv4 |
object |
Optional: Specify an object to configure the internal OVN-Kubernetes masquerade address for host to service traffic for IPv4 addresses. |
ipv6 |
object |
Optional: Specify an object to configure the internal OVN-Kubernetes masquerade address for host to service traffic for IPv6 addresses. |
gatewayConfig.ipv4 object
| Field | Type | Description |
|---|---|---|
internalMasqueradeSubnet |
string |
The masquerade IPv4 addresses that are used internally to enable host to service traffic. The host is configured with these IP addresses and the shared gateway bridge interface. The default value is 169.254.169.0/29.
|
gatewayConfig.ipv6 object
| Field | Type | Description |
|---|---|---|
internalMasqueradeSubnet |
string |
The masquerade IPv6 addresses that are used internally to enable host to service traffic. The host is configured with these IP addresses and the shared gateway bridge interface. The default value is fd69::/125.
|
ipsecConfig object
| Field | Type | Description |
|---|---|---|
mode |
string |
Specifies the behavior of the IPsec implementation. Must be one of the following values:
|
You can only change the configuration for your cluster network plugin during cluster installation, except for the gatewayConfig field that can be changed at runtime as a postinstallation activity.
defaultNetwork:
type: OVNKubernetes
ovnKubernetesConfig:
mtu: 1400
genevePort: 6081
ipsecConfig:
mode: FullCluster Network Operator example configuration
A complete CNO configuration is specified in the following example:
apiVersion: operator.openshift.io/v1
kind: Network
metadata:
name: cluster
spec:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
serviceNetwork:
- 172.30.0.0/16
networkType: OVNKubernetes