Skip to content

Commit cde8aa2

Browse files
jboxmanopenshift-cherrypick-robot
authored andcommitted
Clarify and expand content for additional networks
- openshift#16349
1 parent d0f04ef commit cde8aa2

20 files changed

+512
-218
lines changed

_topic_map.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ Topics:
299299
Topics:
300300
- Name: Understanding multiple networks
301301
File: understanding-multiple-networks
302+
- Name: Attaching a Pod to an additional network
303+
File: attaching-pod
304+
- Name: Removing a Pod from an additional network
305+
File: removing-pod
302306
- Name: Configuring a bridge network
303307
File: configuring-bridge
304308
- Name: Configuring a macvlan network
@@ -309,6 +313,10 @@ Topics:
309313
File: configuring-host-device
310314
- Name: Configuring SR-IOV
311315
File: configuring-sr-iov
316+
- Name: Editing an additional network
317+
File: edit-additional-network
318+
- Name: Removing an additional network
319+
File: remove-additional-network
312320
- Name: OpenShift SDN
313321
Dir: openshift-sdn
314322
Topics:

modules/nw-multus-add-pod.adoc

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
// Module included in the following assemblies:
22
//
3+
// * networking/multiple-networks/attaching-pod.adoc
34

45
[id="nw-multus-add-pod_{context}"]
56
= Adding a Pod to an additional network
67

7-
You can add a Pod to an additional network. {product-title} will continue using
8-
the primary network for normal cluster related network traffic.
8+
You can add a Pod to an additional network. The Pod continues to send normal
9+
cluster related network traffic over the default network.
910

1011
.Prerequisites
1112

13+
* The Pod must be in the same namespace as the additional network.
1214
* Install the OpenShift Command-line Interface (CLI), commonly known as `oc`.
1315
* You must log in to the cluster.
1416

@@ -26,8 +28,7 @@ $ oc edit pod <name>
2628

2729
. In the Pod resource definition, add the `k8s.v1.cni.cncf.io/networks`
2830
parameter to the Pod `metadata` mapping. The `k8s.v1.cni.cncf.io/networks`
29-
accepts a comma separated string of one or more `AdditionalNetworkDefinition`
30-
names:
31+
accepts a comma separated string of one or more NetworkAttachmentDefinition Custom Resource (CR) names:
3132
+
3233
[source,yaml]
3334
----
@@ -59,8 +60,47 @@ spec:
5960
----
6061

6162
. Optional: Confirm that the annotation exists in the Pod CR by running the
62-
following command:
63+
following command. Replace `<name>` with the name of the Pod.
6364
+
6465
----
6566
$ oc describe pod <name>
6667
----
68+
+
69+
In the following example, the `example-pod` Pod is attached to the `net1`
70+
additional network:
71+
+
72+
----
73+
$ oc get pod example-pod -o yaml
74+
apiVersion: v1
75+
kind: Pod
76+
metadata:
77+
annotations:
78+
k8s.v1.cni.cncf.io/networks: macvlan-bridge
79+
k8s.v1.cni.cncf.io/networks-status: |- <1>
80+
[{
81+
"name": "openshift-sdn",
82+
"interface": "eth0",
83+
"ips": [
84+
"10.128.2.14"
85+
],
86+
"default": true,
87+
"dns": {}
88+
},{
89+
"name": "macvlan-bridge",
90+
"interface": "net1",
91+
"ips": [
92+
"20.2.2.100"
93+
],
94+
"mac": "22:2f:60:a5:f8:00",
95+
"dns": {}
96+
}]
97+
name: example-pod
98+
namespace: default
99+
spec:
100+
...
101+
status:
102+
...
103+
----
104+
<1> The `k8s.v1.cni.cncf.io/networks-status` parameter is a JSON array of
105+
objects. Each object describes the status of an additional network attached
106+
to the Pod. The annotation value is stored as a plain text value.
Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
// Module included in the following assemblies:
22
//
3+
// * networking/multiple-networks/configuring-bridge.adoc
34

45
[id="nw-multus-bridge-object_{context}"]
56
= Configuration for bridge
67

7-
// TODO - duplicated in ipvlan, copy changes from there to here.
8+
The configuration for an additional network attachment that uses the bridge
9+
Container Network Interface (CNI) plug-in is provided in two parts:
810

9-
.bridge CNI plug-in YAML configuration
11+
* Cluster Network Operator (CNO) configuration
12+
* CNI plug-in configuration
13+
14+
The CNO configuration specifies the name for the additional network attachment
15+
and the namespace to create the attachment in. The plug-in
16+
is configured by a JSON object specified by the `rawCNIConfig` parameter in
17+
the CNO configuration.
18+
19+
The following YAML describes the configuration parameters for the CNO:
20+
21+
.Cluster Network Operator YAML configuration
1022
[source,yaml]
1123
----
1224
name: <name> <1>
1325
namespace: <namespace> <2>
14-
rawCNIConfig: '' <3>
26+
rawCNIConfig: '{ <3>
27+
...
28+
}'
1529
type: Raw
1630
----
17-
<1> `name`: Specify the name of the `NetworkAttachmentDefinition` created from
18-
the `rawCNIConfig` JSON object.
31+
<1> Specify a name for the additional network attachment that you are
32+
creating. The name must be unique within the specified `namespace`.
33+
34+
<2> Specify the namespace to create the network attachment in. If
35+
you do not specify a value, then the `default` namespace is used.
1936

20-
<2> `namespace`: Specify the namespace to create the network attachment in. If
21-
a value is not specified, the `default` namespace is used.
37+
<3> Specify the CNI plug-in configuration in JSON format, which
38+
is based on the following template.
2239

23-
<3> `rawCNIConfig`: Specify the CNI plug-in configuration.
40+
The following object describes the configuration parameters for the bridge CNI
41+
plug-in:
2442

2543
.bridge CNI plug-in JSON configuration object
2644
[source,json]
@@ -43,42 +61,65 @@ a value is not specified, the `default` namespace is used.
4361
"mtu": <mtu> <11>
4462
}
4563
----
46-
<1> `name`: Specify the name of the `NetworkAttachmentDefinition`.
64+
<1> Specify the value for the `name` parameter you provided previously for
65+
the CNO configuration.
4766

48-
<2> `bridge`: Specify the name of the virtual bridge to use. If the bridge
67+
<2> Specify the name of the virtual bridge to use. If the bridge
4968
interface does not exist on the host, it is created. The default value is
5069
`cni0`.
5170

52-
<3> `ipam`: Specify a configuration object for the ipam CNI plug-in. The plug-in
71+
<3> Specify a configuration object for the ipam CNI plug-in. The plug-in
5372
manages IP address assignment for the network attachment definition.
5473

55-
<4> `ipMasq`: Set to `true` to enable IP masquerading for traffic that leaves the
74+
<4> Set to `true` to enable IP masquerading for traffic that leaves the
5675
virtual network. The source IP address for all traffic is rewritten to the
5776
bridge's IP address. If the bridge does not have an IP address, this setting has
5877
no effect. The default value is `false`.
5978

60-
<5> `isGateway`: Set to `true` to assign an IP address to the bridge. The
79+
<5> Set to `true` to assign an IP address to the bridge. The
6180
default value is `false`.
6281

63-
<6> `isDefaultGateway`: Set to `true` to configure the bridge as the default
82+
<6> Set to `true` to configure the bridge as the default
6483
gateway for the virtual network. The default value is `false`. If
6584
`isDefaultGateway` is set to `true`, then `isGateway` is also set to `true`
6685
automatically.
6786

68-
<7> `forceAddress`: Set to `true` to allow assignment of a previously assigned
87+
<7> Set to `true` to allow assignment of a previously assigned
6988
IP address to the virtual bridge. When set to `false`, if an IPv4 address or an
7089
IPv6 address from overlapping subsets is assigned to the virtual bridge, an
7190
error occurs. The default value is `false`.
7291

73-
<8> `hairpinMode`: Set to `true` to allow the virtual bridge to send an ethernet
92+
<8> Set to `true` to allow the virtual bridge to send an ethernet
7493
frame back through the virtual port it was received on. This mode is also known
7594
as _reflective relay_. The default value is `false`.
7695

77-
<9> `promiscMode`: Set to `true` to enable promiscuous mode on the bridge. The
96+
<9> Set to `true` to enable promiscuous mode on the bridge. The
7897
default value is `false`.
7998

80-
<10> `vlan`: Specify a virtual LAN (VLAN) tag as an integer value. By default,
99+
<10> Specify a virtual LAN (VLAN) tag as an integer value. By default,
81100
no VLAN tag is assigned.
82101

83-
<11> `mtu`: Set the maximum transmission unit (MTU) to the specified value. The
84-
default value is automatically chosen by the kernel.
102+
<11> Set the maximum transmission unit (MTU) to the specified value. The
103+
default value is automatically set by the kernel.
104+
105+
[id="nw-multus-bridge-config-example_{context}"]
106+
== bridge configuration example
107+
108+
The following example configures an additional network named `bridge-net`:
109+
110+
[source,yaml]
111+
----
112+
name: bridge-net
113+
type: Raw
114+
rawCNIConfig: '{ <1>
115+
"cniVersion": "0.3.1",
116+
"type": "bridge",
117+
"master": "eth1",
118+
"isGateway": true,
119+
"vlan": 2,
120+
"ipam": {
121+
"type": "dhcp"
122+
}
123+
}'
124+
----
125+
<1> The CNI configuration object is specified as a YAML string.

modules/nw-multus-create-network.adoc

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Module included in the following assemblies:
22
//
3+
// * networking/multiple-networks/configuring-macvlan.adoc
4+
// * networking/multiple-networks/configuring-ipvlan.adoc
5+
// * networking/multiple-networks/configuring-bridge.adoc
6+
// * networking/multiple-networks/configuring-host-device.adoc
37

48
// Configuring Multus plug-ins using the Cluster Network Operator
59
// is nearly identical in each case.
@@ -26,11 +30,11 @@ endif::[]
2630

2731
The Cluster Network Operator (CNO) manages additional network definitions. When
2832
you specify an additional network to create, the CNO creates the
29-
`NetworkAttachmentDefinition` Custom Resource (CR) automatically.
33+
NetworkAttachmentDefinition Custom Resource (CR) automatically.
3034

3135
[IMPORTANT]
3236
====
33-
Do not edit the `NetworkAttachmentDefinition` CRs that the Cluster Network
37+
Do not edit the NetworkAttachmentDefinition CRs that the Cluster Network
3438
Operator manages. Doing so might disrupt network traffic on your additional
3539
network.
3640
====
@@ -44,14 +48,14 @@ network.
4448

4549
To create an additional network for your cluster, complete the following steps:
4650

47-
. Run the following command to edit the CNO CR:
51+
. Edit the CNO CR by running the following command:
4852
+
4953
----
5054
$ oc edit networks.operator.openshift.io cluster
5155
----
5256

5357
. Modify the CR that you are creating by adding the configuration for the
54-
additional network you are creating.
58+
additional network you are creating, as in the following example CR.
5559
+
5660
ifdef::yaml[]
5761
The following YAML configures the {plugin} CNI plug-in:
@@ -68,7 +72,10 @@ spec:
6872
type: SimpleMacvlan
6973
simpleMacvlanConfig:
7074
ipamConfig:
71-
type: DHCP
75+
type: static
76+
staticIPAMConfig:
77+
addresses:
78+
- address: 10.1.1.0/24
7279
----
7380
endif::yaml[]
7481
ifdef::json[]
@@ -91,8 +98,13 @@ spec:
9198
"type": "{plugin}",
9299
"master": "eth1",
93100
"ipam": {
94-
"type": "dhcp"
95-
}
101+
"type": "static",
102+
"addresses": [
103+
{
104+
"address": "191.168.1.1/24"
105+
}
106+
]
107+
}
96108
}'
97109
----
98110
endif::[]
@@ -131,17 +143,21 @@ spec:
131143
"master": "eth1",
132144
"mode": "l2",
133145
"ipam": {
134-
"type": "dhcp"
135-
}
146+
"type": "static",
147+
"addresses": [
148+
{
149+
"address": "191.168.1.1/24"
150+
}
151+
]
152+
}
136153
}'
137154
----
138155
endif::[]
139-
<1> `additionalNetworks`: Specify the configuration for the additional network
140-
attachment definition.
156+
<1> Specify the configuration for the additional network attachment definition.
141157

142158
. Save your changes and quit the text editor to commit your changes.
143159

144-
. Optional: Confirm that the CNO created the `NetworkAttachmentDefinition` CR by
160+
. Optional: Confirm that the CNO created the NetworkAttachmentDefinition CR by
145161
running the following command. There might be a delay before the CNO creates the
146162
CR.
147163
+

modules/nw-multus-delete-network.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Module included in the following assemblies:
22
//
3+
// * networking/multiple-networks/remove-additional-network.adoc
34

45
[id="nw-multus-delete-network_{context}"]
56
= Removing an additional network attachment definition
@@ -24,8 +25,8 @@ For more information, see link:https://bugzilla.redhat.com/show_bug.cgi?id=17559
2425

2526
To remove an additional network from your cluster, complete the following steps:
2627

27-
. Run the following command to edit the Cluster Network Operator (CNO) in your
28-
default text editor:
28+
. Edit the Cluster Network Operator (CNO) in your default text editor by running
29+
the following command:
2930
+
3031
----
3132
$ oc edit networks.operator.openshift.io cluster

modules/nw-multus-edit-network.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
// Module included in the following assemblies:
22
//
3+
// * networking/multiple-networks/edit-additional-network.adoc
34

45
[id="nw-multus-edit-network_{context}"]
56
= Modifying an additional network attachment definition
67

78
As a cluster administrator, you can make changes to an existing additional
8-
network.
9+
network. Any existing Pods attached to the additional network will not be updated.
910

1011
.Prerequisites
1112

13+
* You have configured an additional network for your cluster.
1214
* Install the OpenShift Command-line Interface (CLI), commonly known as `oc`.
1315
* Log in as a user with `cluster-admin` privileges.
1416

@@ -28,17 +30,17 @@ your changes.
2830

2931
. Save your changes and quit the text editor to commit your changes.
3032

31-
. Optional: Confirm that the CNO updated the `NetworkAttachmentDefinition` CR by
33+
. Optional: Confirm that the CNO updated the NetworkAttachmentDefinition CR by
3234
running the following command. Replace `<network-name>` with the name of the
3335
additional network to display. There might be a delay before the CNO updates the
34-
`NetworkAttachmentDefinition` CR to reflect your changes.
36+
NetworkAttachmentDefinition CR to reflect your changes.
3537
+
3638
----
3739
$ oc get network-attachment-definitions <network-name> -o yaml
3840
----
3941
+
4042
For example, the following console output displays a
41-
`NetworkAttachmentDefinition` that is named `net1`:
43+
NetworkAttachmentDefinition that is named `net1`:
4244
+
4345
----
4446
$ oc get network-attachment-definitions net1 -o go-template='{{printf "%s\n" .spec.config}}'

0 commit comments

Comments
 (0)