1
1
# Antrea Secondary Network Support
2
2
3
+ ## Table of Contents
4
+
5
+ <!-- toc -->
6
+ - [ Introduction] ( #introduction )
7
+ - [ Prerequisites] ( #prerequisites )
8
+ - [ Configurations] ( #configurations )
9
+ - [ VLAN] ( #vlan )
10
+ - [ OVS bridge configuration] ( #ovs-bridge-configuration )
11
+ - [ Secondary VLAN network configuration] ( #secondary-vlan-network-configuration )
12
+ - [ Pod secondary interface configuration] ( #pod-secondary-interface-configuration )
13
+ - [ SR-IOV] ( #sr-iov )
14
+ - [ Creating network functions] ( #creating-network-functions )
15
+ - [ Installing SR-IOV Network Device Plugin] ( #installing-sr-iov-network-device-plugin )
16
+ - [ Secondary SR-IOV network configuration] ( #secondary-sr-iov-network-configuration )
17
+ - [ Pod secondary interface configuration] ( #pod-secondary-interface-configuration-1 )
18
+ - [ Limitations] ( #limitations )
19
+ <!-- /toc -->
20
+
21
+ ## Introduction
22
+
3
23
Antrea can work with Multus, in which case Antrea is the primary CNI of the
4
24
Kubernetes cluster and provisions the "primary" network interfaces of Pods;
5
25
while Multus manages secondary networks and executes other CNIs to create
6
26
secondary network interfaces of Pods. The [ Antrea + Multus guide] ( cookbooks/multus )
7
27
talks about how to use Antrea with Multus.
8
28
9
- Starting with Antrea v1.15, Antrea can also provision secondary network
10
- interfaces and connect them to VLAN networks. This document describes Antrea's
11
- native support for VLAN secondary networks.
29
+ Starting with Antrea v1.5, native support for secondary networks was introduced,
30
+ initially for SR-IOV based networks. In Antrea v1.15, support was extended to
31
+ include VLAN-based networks. The table below summarizes the capabilities of this
32
+ feature across different releases.
33
+
34
+ | Release | SR-IOV on Bare-Metal Server | VLAN | SR-IOV on Virtual Machine |
35
+ | ---------------| -----------------------------| ---------| ---------------------------|
36
+ | v1.5 - v1.14 | ` Alpha ` | | |
37
+ | v1.15 - v2.2 | ` Alpha ` | ` Alpha ` | |
38
+ | v2.3 - latest | ` Alpha ` | ` Alpha ` | ` Alpha ` |
39
+
40
+ This document describes steps to enable and use Antrea's native support for
41
+ secondary networks.
12
42
13
43
## Prerequisites
14
44
@@ -46,7 +76,17 @@ following command:
46
76
kubectl apply -f https://github.com/k8snetworkplumbingwg/network-attachment-definition-client/raw/master/artifacts/networks-crd.yaml
47
77
` ` `
48
78
49
- # # Secondary OVS bridge configuration
79
+ # # Configurations
80
+
81
+ You can configure secondary networks for your Pods using one or more of the
82
+ following types :
83
+
84
+ - [VLAN](#vlan)
85
+ - [SR-IOV](#sr-iov)
86
+
87
+ # ## VLAN
88
+
89
+ # ### OVS bridge configuration
50
90
51
91
A VLAN secondary interface will be connected to a separate OVS bridge on the
52
92
Node. You can specify the secondary OVS bridge configuration in the
@@ -77,7 +117,7 @@ is moved to the OVS bridge, because of the interface state change. Please consid
77
117
a static DNS configuration in `/etc/systemd/resolved.conf` before installing Antrea to
78
118
use the primary NIC as a physical interface. Check more details on [issue 6558](https://github.com/antrea-io/antrea/issues/6558).
79
119
80
- # # Secondary VLAN network configuration
120
+ # ### Secondary VLAN network configuration
81
121
82
122
A secondary VLAN network is defined by a NetworkAttachmentDefinition CR. For
83
123
example, the following NetworkAttachmentDefinition defines a VLAN network
@@ -112,7 +152,7 @@ interface, OVS will insert the VLAN tag in the packets.
112
152
A few extra notes about the NetworkAttachmentDefinition `config` fields :
113
153
114
154
* `type` - must be set to `antrea`.
115
- * `networkType` - the only supported network type is `vlan` as of now .
155
+ * `networkType` - should be set to `vlan` if VLAN-based network is desired .
116
156
* `mtu` - defaults to 1500 if not set.
117
157
* `vlan` - can be set to 0 or a valid VLAN ID (1 - 4094). Defaults to 0. The
118
158
VLAN ID can also be specified as part of the spec of an IPPool referenced in the
@@ -122,7 +162,7 @@ the VLAN in IPPool(s) if both are set.
122
162
network won't have an IP address allocated. For more information about secondary
123
163
network IPAM configuration, please refer to the [Antrea IPAM document](antrea-ipam.md#ipam-for-secondary-network).
124
164
125
- # # Pod secondary interface configuration
165
+ # ### Pod secondary interface configuration
126
166
127
167
You can create a Pod with secondary network interfaces by adding the
128
168
` k8s.v1.cni.cncf.io/networks` annotation to the Pod. The following example Pod
@@ -134,9 +174,7 @@ is created in Namespace `networks`.
134
174
apiVersion: v1
135
175
kind: Pod
136
176
metadata:
137
- name: sample-pod
138
- labels:
139
- app: antrea-secondary-network-demo
177
+ name: sample-pod-secondary-network-vlan
140
178
annotations:
141
179
k8s.v1.cni.cncf.io/networks: '[
142
180
{"name": "vlan100"},
@@ -159,9 +197,7 @@ For example:
159
197
apiVersion: v1
160
198
kind: Pod
161
199
metadata:
162
- name: sample-pod
163
- labels:
164
- app: antrea-secondary-network-demo
200
+ name: sample-pod-secondary-network-vlan
165
201
annotations:
166
202
k8s.v1.cni.cncf.io/networks: networks/vlan200@eth200
167
203
spec:
@@ -170,7 +206,110 @@ spec:
170
206
image: antrea/toolbox:latest
171
207
` ` `
172
208
173
- **At the moment, we do NOT support annotation update / removal: when the
209
+ # ## SR-IOV
210
+
211
+ # ### Creating network functions
212
+
213
+ To configure SR-IOV network for Pods, the required network functions must be
214
+ available on the Kubernetes Node, whether it is a virtual machine or a
215
+ bare-metal server. You can follow the following docs to create SR-IOV Virtual
216
+ Functions (VFs) or Subfunctions (SFs).
217
+
218
+ * [Creating SR-IOV Virtual Functions](https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin/blob/master/docs/vf-setup.md)
219
+ * [Creating Subfunctions](https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin/blob/master/docs/subfunctions/README.md)
220
+
221
+ **While the implementation is designed to work with all SR-IOV capable NICs,
222
+ we currently lack the resources to test every model, particularly those with
223
+ SFs. Please open an issue if you encounter issues with a specific NIC.**
224
+
225
+ # ### Installing SR-IOV Network Device Plugin
226
+
227
+ After creating network functions, you need to install the [SR-IOV Network
228
+ Device Plugin](https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin),
229
+ a Kubernetes device plugin that discovers and advertises networking resources,
230
+ including SR-IOV VFs and SFs, on a Kubernetes Node. You can follow [this doc](https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin?tab=readme-ov-file#install-sr-iov-network-device-plugin)
231
+ to install the plugin.
232
+
233
+ On successful installation, the allocatable resource list for the Node should
234
+ be updated with network resources discovered by the plugin, as shown below :
235
+
236
+ ` ` ` bash
237
+ $ kubectl get node node1 -o json | jq '.status.allocatable'
238
+ {
239
+ "cpu": "8",
240
+ "ephemeral-storage": "169986638772",
241
+ "hugepages-1Gi": "0",
242
+ "hugepages-2Mi": "8Gi",
243
+ "intel.com/sriov_net_A": "8",
244
+ "intel.com/sriov_net_B": "8",
245
+ "memory": "7880620Ki",
246
+ "pods": "1k"
247
+ }
248
+ ` ` `
249
+
250
+ # ### Secondary SR-IOV network configuration
251
+
252
+ You can now define a secondary SR-IOV network using a
253
+ NetworkAttachmentDefinition of `sriov` network type, which references the
254
+ discovered network resource. For example, the following
255
+ NetworkAttachmentDefinition defines a SR-IOV network named `sriov-net-a`, linked
256
+ to the network resource `intel.com/sriov_net_A` :
257
+
258
+ ` ` ` yaml
259
+ apiVersion: "k8s.cni.cncf.io/v1"
260
+ kind: NetworkAttachmentDefinition
261
+ metadata:
262
+ name: sriov-net-a
263
+ annotations:
264
+ k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_net_A
265
+ spec:
266
+ config: '{
267
+ "cniVersion": "0.3.0",
268
+ "type": "antrea",
269
+ "networkType": "sriov",
270
+ "ipam": {
271
+ "type": "antrea",
272
+ "ippools": ["sriov-ipv4"]
273
+ }
274
+ }'
275
+ ` ` `
276
+
277
+ A few extra notes about the NetworkAttachmentDefinition `config` fields :
278
+
279
+ * `type` - must be set to `antrea`.
280
+ * `networkType` - should be set to `sriov` if SR-IOV based network is desired.
281
+ * `mtu` - defaults to 1500 if not set.
282
+ * `ipam` - it is optional. If not set, the secondary interfaces created for the
283
+ network won't have an IP address allocated. For more information about secondary
284
+ network IPAM configuration, please refer to the [Antrea IPAM document](antrea-ipam.md#ipam-for-secondary-network).
285
+
286
+ # ### Pod secondary interface configuration
287
+
288
+ Finally, to create a Pod with a secondary SR-IOV interface, add the
289
+ ` k8s.v1.cni.cncf.io/networks` annotation to the Pod, specifying the desired
290
+ SR-IOV network.
291
+
292
+ ` ` ` yaml
293
+ apiVersion: v1
294
+ kind: Pod
295
+ metadata:
296
+ name: sample-pod-secondary-network-sriov
297
+ annotations:
298
+ k8s.v1.cni.cncf.io/networks: sriov-net-a
299
+ spec:
300
+ containers:
301
+ - name: toolbox
302
+ image: antrea/toolbox:latest
303
+ resources:
304
+ requests:
305
+ intel.com/sriov_net_A: '1'
306
+ limits:
307
+ intel.com/sriov_net_A: '1'
308
+ ` ` `
309
+
310
+ # # Limitations
311
+
312
+ * At the moment, we do NOT support annotation update / removal: when the
174
313
annotation is added to the Pod for the first time (e.g., when creating the
175
314
Pod), we will configure the secondary network interfaces accordingly, and no
176
- change is possible after that, until the Pod is deleted.**
315
+ change is possible after that, until the Pod is deleted.
0 commit comments