• Stars
    star
    308
  • Rank 135,712 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DPDK & SR-IOV CNI plugin

Build Status Go Report Card Weekly minutes Coverage Status

SR-IOV CNI plugin

This plugin enables the configuration and usage of SR-IOV VF networks in containers and orchestrators like Kubernetes.

Network Interface Cards (NICs) with SR-IOV capabilities are managed through physical functions (PFs) and virtual functions (VFs). A PF is used by the host and usually represents a single NIC port. VF configurations are applied through the PF. With SR-IOV CNI each VF can be treated as a separate network interface, assigned to a container, and configured with it's own MAC, VLAN, IP and more.

SR-IOV CNI plugin works with SR-IOV device plugin for VF allocation in Kubernetes. A metaplugin such as Multus gets the allocated VF's deviceID(PCI address) and is responsible for invoking the SR-IOV CNI plugin with that deviceID.

Build

This plugin uses Go modules for dependency management and requires Go 1.17+ to build.

To build the plugin binary:

make

Upon successful build the plugin binary will be available in build/sriov.

Kubernetes Quick Start

A full guide on orchestrating SR-IOV virtual functions in Kubernetes can be found at the SR-IOV Device Plugin project.

Creating VFs is outside the scope of the SR-IOV CNI plugin. More information about allocating VFs on different NICs can be found here

To deploy SR-IOV CNI by itself on a Kubernetes 1.16+ cluster:

kubectl apply -f images/sriov-cni-daemonset.yaml

Note The above deployment is not sufficient to manage and configure SR-IOV virtual functions. See the full orchestration guide for more information.

Usage

SR-IOV CNI networks are commonly configured using Multus and SR-IOV Device Plugin using Network Attachment Definitions. More information about configuring Kubernetes networks using this pattern can be found in the Multus configuration reference document.

A Network Attachment Definition for SR-IOV CNI takes the form:

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: sriov-net1
  annotations:
    k8s.v1.cni.cncf.io/resourceName: intel.com/intel_sriov_netdevice
spec:
  config: '{
  "type": "sriov",
  "cniVersion": "0.3.1",
  "name": "sriov-network",
  "ipam": {
    "type": "host-local",
    "subnet": "10.56.217.0/24",
    "routes": [{
      "dst": "0.0.0.0/0"
    }],
    "gateway": "10.56.217.1"
  }
}'

The .spec.config field contains the configuration information used by the SR-IOV CNI.

Basic configuration parameters

The following parameters are generic parameters which are not specific to the SR-IOV CNI configuration, though (with the exception of ipam) they need to be included in the config.

  • cniVersion : the version of the CNI spec used.
  • type : CNI plugin used. "sriov" corresponds to SR-IOV CNI.
  • name : the name of the network created.
  • ipam (optional) : the configuration of the IP Address Management plugin. Required to designate an IP for a kernel interface.

Example configurations

The following examples show the config needed to set up basic SR-IOV networking in a container. Each of the json config objects below can be placed in the .spec.config field of a Network Attachment Definition to integrate with Multus.

Kernel driver config

This is the minimum configuration for a working kernel driver interface using an SR-IOV Virtual Function. It applies an IP address using the host-local IPAM plugin in the range of the subnet provided.

{
  "type": "sriov",
  "cniVersion": "0.3.1",
  "name": "sriov-network",
  "ipam": {
    "type": "host-local",
    "subnet": "10.56.217.0/24",
    "routes": [{
      "dst": "0.0.0.0/0"
    }],
    "gateway": "10.56.217.1"
  }
}

Extended kernel driver config

This configuration sets a number of extra parameters that may be key for SR-IOV networks including a vlan tag, disabled spoof checking and enabled trust mode. These parameters are commonly set in more advanced SR-IOV VF based networks.

{
  "cniVersion": "0.3.1",
  "name": "sriov-advanced",
  "type": "sriov",
  "vlan": 1000,
  "spoofchk": "off",
  "trust": "on",
  "ipam": {
    "type": "host-local",
    "subnet": "10.56.217.0/24",
    "routes": [{
      "dst": "0.0.0.0/0"
    }],
    "gateway": "10.56.217.1"
  }
}

DPDK userspace driver config

The below config will configure a VF using a userspace driver (uio/vfio) for use in a container. If this plugin is used with a VF bound to a dpdk driver then the IPAM configuration will still be respected, but it will only allocate IP address(es) using the specified IPAM plugin, not apply the IP address(es) to container interface. Other config parameters should be applicable but implementation may be driver specific.

{
    "cniVersion": "0.3.1",
    "name": "sriov-dpdk",
    "type": "sriov",
    "vlan": 1000
}

Note DHCP IPAM plugin can not be used for VF bound to a dpdk driver (uio/vfio).

Note When VLAN is not specified in the Network-Attachment-Definition, or when it is given a value of 0, VFs connected to this network will have no vlan tag.

Advanced Configuration

SR-IOV CNI allows the setting of other SR-IOV options such as link-state and quality of service parameters. To learn more about how these parameters are set consult the SR-IOV CNI configuration reference guide

Contributing

To report a bug or request a feature, open an issue on this repo using one of the available templates.

More Repositories

1

multus-cni

A CNI meta-plugin for multi-homed pods in Kubernetes
Go
2,332
star
2

sriov-network-device-plugin

SRIOV network device plugin for Kubernetes
Go
400
star
3

whereabouts

A CNI IPAM plugin that assigns IP addresses cluster-wide
Go
279
star
4

ovs-cni

Open vSwitch CNI plugin
Go
219
star
5

sriov-network-operator

Operator for provisioning and configuring SR-IOV CNI plugin and device plugin
Go
82
star
6

bond-cni

Bond-cni is for fail-over and high availability of networking in cloudnative orchestration
Go
63
star
7

reference-deployment

Resources for K8s NPWG's deployment
Shell
44
star
8

multi-net-spec

Multi-network CRD specification
43
star
9

ib-sriov-cni

InfiniBand SR-IOV CNI
Go
42
star
10

network-resources-injector

A Kubernetes Dynamic Admission Controller that patches Pods to add additional information.
Go
42
star
11

rdma-cni

RDMA CNI plugin for containerized workloads
Go
41
star
12

kubemacpool

Go
35
star
13

sriovnet

Go library/package to configure SRIOV networking devices
Go
31
star
14

multus-dynamic-networks-controller

A Kubernetes controller listening to pod's network selection elements. When the multus annotations changes, it will invoke the corresponding delegate
Go
27
star
15

sriov-network-metrics-exporter

Exporter that reads metrics for SR-IOV Virtual Functions and exposes them in the Prometheus format.
Go
24
star
16

multus-service

(TBD)
Go
23
star
17

community

The Network Plumbing Working Group Community information
21
star
18

helm-charts

Helm charts for deployment of NPWG implementations and ancillary tools
Smarty
20
star
19

k8s-net-attach-def-controller

K8s Multi- network service controller
Go
16
star
20

multi-networkpolicy

Go
15
star
21

accelerated-bridge-cni

Go
12
star
22

network-attachment-definition-client

A Golang Kubernetes client
Go
11
star
23

kubectl-multinet

This is a kubectl plugin which outputs Pods' network-status of multi-net-spec,
Go
11
star
24

multi-networkpolicy-iptables

MultiNetworkPolicy iptable based implementation
Go
11
star
25

multi-networkpolicy-tc

Linux Traffic Control (TC) based implementation of Kubernetes NPWG MultiNetworkPolicy API
Go
10
star
26

multusctl

CLI client for Multus CNI
Go
7
star
27

ptp-operator

PTP Operator manages cluster wide PTP configuration
Go
7
star
28

net-attach-def-admission-controller

An admission controller to check resources as defined by the NPWG spec
Go
5
star
29

bridge-operator

Bridge-operator manages linux bridge in Kubernetes cluster node.
Go
4
star
30

cni-log

Cni-log provides general logging functionality for Container Network Interfaces (CNI).
Go
3
star
31

net-service-controller

Network service controller (Multus compatible)
Go
3
star
32

device-info-spec

3
star