1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/microshift-cni-multus-nad-additional-network.adoc
2025-10-07 17:43:41 +00:00

89 lines
3.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * microshift_networking/microshift_multiple_networks/microshift-cni-multus-using.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-cni-multus-nad-additional-network_{context}"]
= Creating a NetworkAttachmentDefinition for an additional network
Use the following procedure to create a `NetworkAttachmentDefinition` configuration file for an additional network. In this example, a bridge-type interface is used. You can also use the example workflow here that uses `host-local` IP address management (IPAM) to configure other supported additional network types.
[IMPORTANT]
====
If you use `bridge` and the `dhcp` IPAM, a DHCP server listening on the bridged network is required. If you are also using a firewall, configuring the firewalld service to allow DHCP traffic on the network zone is also required. You can run the `firewall-cmd --remove-service=dhcp` command in this case.
====
.Prerequisites
* The {microshift-short} Multus CNI is installed.
* The {oc-first} is installed.
* {microshift-short} is running.
.Procedure
. Optional: Verify that the {microshift-short} node is running with the Multus CNI by running the following command:
+
[source,terminal]
----
$ oc get pods -n openshift-multus
----
+
.Example output
[source,terminal]
----
NAME READY STATUS RESTARTS AGE
dhcp-daemon-dfbzw 1/1 Running 0 5h
multus-rz8xc 1/1 Running 0 5h
----
. Create a `NetworkAttachmentDefinition` configuration file by running the following command and using the following example file for reference:
+
[source,terminal]
----
$ oc apply -f network-attachment-definition.yaml
----
+
.Example `NetworkAttachmentDefinition` file
[source,yaml]
----
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: bridge-conf
spec:
config: '{
"cniVersion": "0.4.0",
"type": "bridge", <1>
"bridge": "br-test", <2>
"mode": "bridge",
"ipam": {
"type": "host-local", <3>
"ranges": [
[
{
"subnet": "10.10.0.0/24",
"rangeStart": "10.10.0.20",
"rangeEnd": "10.10.0.50",
"gateway": "10.10.0.254"
}
],
[
{
"subnet": "fd00:IJKL:MNOP:10::0/64", <4>
"rangeStart": "fd00:IJKL:MNOP:10::1",
"rangeEnd": "fd00:IJKL:MNOP:10::9"
"dataDir": "/var/lib/cni/br-test"
}
}'
----
<1> The `type` value specifies a name of the CNI plugin. This example uses the `bridge` type.
<2> The `bridge` value is name of the bridge on the {microshift-short} host that is used. The additional interface of the pod is connected to that bridge. If the interface does not exist on the host, the Bridge CNI creates it. If the interface already exists, it is reused. In this example, the name of the interface is `br-test`.
<3> The IPAM type.
<4> IPv6 addresses can be added to the secondary interface.
+
--
[NOTE]
====
Using the name of the bridge is specific to the `bridge` type of plugin. Other plugins use different fields in their `NetworkAttachmentDefinitions`. For example, the `macvlan` and `ipvlan` configurations use `master` to specify the host interface to attach.
====
--