docs/doc/source/usertasks/kubernetes/host-device-plugin-714d4862a825.rst
Ron Stone 539fb24b44 Container Network Interface (CNI) Plugin Up-version
Add descriptions and examples of new CNI plugins.
Note: Bond plugin is covered in https://review.opendev.org/c/starlingx/docs/+/837599
Content restructuring per patchset 1 comments.
Patchset 2 review updates.
Patchset 3 review updates.
Fix merge conflict.
eth1001 > eth1000 for consistency in example.
Patchset 6 review updates.

Story: 2009832
Task: 45235

Signed-off-by: Ron Stone <ronald.stone@windriver.com>
Change-Id: Idab0308ff8f973c4aa20b66fbcfb932bf3dcf92c
2022-06-02 12:58:54 -04:00

1.3 KiB

Host-device Plugin

The host-device plugin allows a device on the host to be moved into the container namespace as an additional interface. The device can be specified with one of the following parameters:

device (string)

The device name.

hwaddr (string)

The address of the device.

kernelpath (string)

The kernel device kobj. For example: /sys/devices/pci0000:00/0000:00:1f.6

pciBusID (string)

The address of network device. For example, 0000:00:1f.6

The following example would create a pod which contains an additional network interface corresponding to the eth1000 device:

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: hd0
spec:
  config: '{
    "cniVersion": "0.3.1",
    "name": "hd0",
    "type": "host-device",
    "device": "eth1000"
  }'
---
apiVersion: v1
kind: Pod
metadata:
  name: hdpod0
  annotations:
    k8s.v1.cni.cncf.io/networks: '[
            { "name": "hd0" }
    ]'
spec:
  containers:
  - name: hdpod0
    image: centos/tools
    imagePullPolicy: IfNotPresent
    command: [ "/bin/bash", "-c", "--" ]
    args: [ "while true; do sleep 300000; done;" ]