SR-IOV CNI est un plugin CNI qui permet d'attacher des Virtual Functions (VF) SR-IOV directement dans des pods Kubernetes. SR-IOV (Single Root I/O Virtualization) est une technologie matérielle qui permet à une carte réseau physique (Physical Function, PF) d'exposer plusieurs fonctions virtuelles (VF) isolées, chacune étant assignable à un pod ou une VM avec des performances proches du wire-rate.
SR-IOV CNI est un plugin secondaire : il s'utilise obligatoirement avec Multus comme orchestrateur CNI et le SR-IOV Device Plugin pour exposer les VF comme ressources Kubernetes.
Idéal pour : workloads télécoms (5G, NFV, vRAN), HPC, financial trading - partout où la latence et le débit réseau sont critiques et où l'overhead de virtualisation est inacceptable.
Informations essentielles
Origine : Intel / k8snetworkplumbingwg · Licence : Apache 2.0 · Architectures : x86_64 (principalement)
Liens : GitHub SR-IOV CNI · GitHub SR-IOV Device Plugin · Releases
Support : Maintenu par Intel et le Network Plumbing WG.
Stack complète SR-IOV dans Kubernetes
| Composant | Rôle |
|---|---|
| NIC SR-IOV compatible | Hardware - expose PF et VF (Intel X710, Mellanox ConnectX...) |
| SR-IOV Device Plugin | Expose les VF comme ressources K8s (intel.com/...) |
| Multus CNI | Meta-plugin - orchestre le CNI primaire + SR-IOV CNI |
| SR-IOV CNI | Attache une VF dans le namespace réseau du pod |
| CNI primaire | Gère le réseau de gestion (eth0) - Calico, Flannel, etc. |
Prérequis matériels et système
# 1. Vérifier que la NIC supporte SR-IOV
lspci | grep -i ethernet
# Chercher : Intel X710, X722, i40e, Mellanox ConnectX-4/5/6, etc.
# 2. Vérifier que SR-IOV est activé dans le BIOS
# Option BIOS : "SR-IOV Support" ou "PCIe ARI Support" -> Enabled
# 3. Vérifier IOMMU activé
dmesg | grep -i iommu
# Ou dans /etc/default/grub : GRUB_CMDLINE_LINUX="intel_iommu=on iommu=pt"
# 4. Créer les Virtual Functions (adapter <interface> et <nombre>)
echo 4 > /sys/class/net/eth1/device/sriov_numvfs
# Vérifier
ip link show eth1
# Doit afficher les VFs créées
Installation
1. Installer Multus (prérequis)
kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset-thick.yml
2. Installer le SR-IOV Device Plugin
kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/sriov-network-device-plugin/master/deployments/k8s-v1.16/sriovdp-daemonset.yaml
3. Configurer le SR-IOV Device Plugin
# sriov-dp-config.yaml - ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: sriovdp-config
namespace: kube-system
data:
config.json: |
{
"resourceList": [
{
"resourceName": "intel_sriov_netdevice",
"resourcePrefix": "intel.com",
"selectors": {
"vendors": ["8086"],
"devices": ["154c", "10ed"],
"drivers": ["iavf", "i40evf"]
}
}
]
}
kubectl apply -f sriov-dp-config.yaml
# Vérifier que les VF sont exposées comme ressources
kubectl get nodes -o json | jq '.items[].status.allocatable | with_entries(select(.key | startswith("intel.com")))'
4. Installer SR-IOV CNI
# Copier le binaire SR-IOV CNI sur chaque nœud
# (ou utiliser le DaemonSet d'installation)
kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/sriov-cni/master/images/sriov-cni-daemonset.yaml
Configurer le réseau SR-IOV (NetworkAttachmentDefinition)
# nad-sriov.yaml
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: sriov-net
namespace: default
annotations:
k8s.v1.cni.cncf.io/resourceName: intel.com/intel_sriov_netdevice
spec:
config: |
{
"cniVersion": "0.3.1",
"name": "sriov-net",
"type": "sriov",
"ipam": {
"type": "host-local",
"subnet": "10.56.217.0/24",
"rangeStart": "10.56.217.171",
"rangeEnd": "10.56.217.181",
"routes": [
{"dst": "0.0.0.0/0"}
],
"gateway": "10.56.217.1"
}
}
kubectl apply -f nad-sriov.yaml
Déployer un pod avec SR-IOV
apiVersion: v1
kind: Pod
metadata:
name: testpod-sriov
annotations:
# Réseau secondaire SR-IOV via Multus
k8s.v1.cni.cncf.io/networks: sriov-net
spec:
containers:
- name: app
image: alpine
command: ["sleep", "3600"]
resources:
requests:
# Réserver une VF SR-IOV
intel.com/intel_sriov_netdevice: "1"
limits:
intel.com/intel_sriov_netdevice: "1"
kubectl apply -f testpod-sriov.yaml
# Vérifier les interfaces réseau dans le pod
kubectl exec testpod-sriov -- ip addr
# eth0 = réseau primaire
# net1 = VF SR-IOV (performances wire-rate)
Troubleshooting
Aucune VF disponible dans le cluster
# Vérifier que les VF sont créées sur les nœuds
echo 4 > /sys/class/net/eth1/device/sriov_numvfs
ip link show eth1 | grep -i vf
# Vérifier que le Device Plugin les détecte
kubectl get nodes -o json | jq '.items[].status.allocatable'
# Doit afficher "intel.com/intel_sriov_netdevice": "4" (ou autre nombre)
# Logs du SR-IOV Device Plugin
kubectl -n kube-system logs ds/kube-sriov-device-plugin-amd64
Pod Pending - "Insufficient intel.com/intel_sriov_netdevice"
# Pas assez de VF disponibles
kubectl get nodes -o json | jq '.items[].status.allocatable | with_entries(select(.key | startswith("intel.com")))'
# Augmenter le nombre de VF
echo 8 > /sys/class/net/eth1/device/sriov_numvfs
# Pour rendre la configuration persistante (systemd)
cat > /etc/systemd/system/sriov-vfs.service << EOF
[Unit]
Description=Create SR-IOV VFs
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo 4 > /sys/class/net/eth1/device/sriov_numvfs'
[Install]
WantedBy=multi-user.target
EOF
systemctl enable sriov-vfs
VF non attachée dans le pod
kubectl describe pod testpod-sriov
# Chercher les events CNI
# Vérifier que SR-IOV CNI est bien installé sur les nœuds
ls /opt/cni/bin/sriov
Commandes utiles
# Hardware SR-IOV
lspci | grep -i ethernet
echo 4 > /sys/class/net/<interface>/device/sriov_numvfs
ip link show <interface> # voir les VFs
# Kubernetes
kubectl get network-attachment-definitions
kubectl get nodes -o json | jq '.items[].status.allocatable'
kubectl describe pod <pod> # vérifier les resources SR-IOV
# Logs
kubectl -n kube-system logs ds/kube-sriov-device-plugin-amd64
kubectl -n kube-system logs ds/kube-multus-ds
# Dans le pod
kubectl exec <pod> -- ip addr
kubectl exec <pod> -- ethtool -i net1 # infos sur l'interface SR-IOV
Ressources
- GitHub SR-IOV CNI : https://github.com/k8snetworkplumbingwg/sriov-cni
- GitHub SR-IOV Device Plugin : https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin
- Multus CNI (prérequis) : https://github.com/k8snetworkplumbingwg/multus-cni
- Guide Intel SR-IOV : https://www.intel.com/content/www/us/en/architecture-and-technology/single-root-io-virtualization-and-sharing.html