| 1 |
# debug plugin |
| 2 |
|
| 3 |
## Overview |
| 4 |
|
| 5 |
This plugin aims to help debugging or troubleshooting in CNI plugin development. |
| 6 |
|
| 7 |
## Example Configuration |
| 8 |
|
| 9 |
``` |
| 10 |
{ |
| 11 |
"cniVersion": "0.3.1", |
| 12 |
"name": "mynet", |
| 13 |
"plugins": [ |
| 14 |
{ |
| 15 |
"type": "ptp", |
| 16 |
"ipMasq": true, |
| 17 |
"ipam": { |
| 18 |
"type": "host-local", |
| 19 |
"subnet": "172.16.30.0/24", |
| 20 |
"routes": [ |
| 21 |
{ |
| 22 |
"dst": "0.0.0.0/0" |
| 23 |
} |
| 24 |
] |
| 25 |
} |
| 26 |
}, |
| 27 |
{ |
| 28 |
"type": "debug", |
| 29 |
"cniOutput": "/tmp/cni_output.txt", |
| 30 |
"addHooks": [ |
| 31 |
[ "sh", "-c", "ip link set $CNI_IFNAME promisc on" ] |
| 32 |
] |
| 33 |
}, |
| 34 |
{ |
| 35 |
"type": "portmap", |
| 36 |
"capabilities": {"portMappings": true}, |
| 37 |
"externalSetMarkChain": "KUBE-MARK-MASQ" |
| 38 |
} |
| 39 |
] |
| 40 |
} |
| 41 |
``` |
| 42 |
|
| 43 |
## Config Reference |
| 44 |
|
| 45 |
* `cniOutput` (string, optional): output CNI request into file. |
| 46 |
* `addHooks` (string array, optional): commands executed in container network namespace at interface add. |
| 47 |
(note: but just execute it and does not catch command failure) |
| 48 |
* `delHooks` (string array, optional): commands executed in container network namespace at interface delete. |
| 49 |
(note: but just execute it and does not catch command failure) |
| 50 |
* `checkHooks` (string array, optional): commands executed in container network namespace at interface check. |
| 51 |
(note: but just execute it and does not catch command failure) |
| 52 |
|
| 53 |
### Sample CNI Ouput |
| 54 |
|
| 55 |
``` |
| 56 |
CmdAdd |
| 57 |
ContainerID: cnitool-20c433bb2b1d6ede56d6 |
| 58 |
Netns: /var/run/netns/cnitest |
| 59 |
IfName: eth0 |
| 60 |
Args: |
| 61 |
Path: /opt/cni/bin |
| 62 |
StdinData: {"cniOutput":"/tmp/cni_output.txt","cniVersion":"0.3.1","name":"test","prevResult":{"cniVersion":"0.3.1","interfaces":[{"name":"veth92e295cc","mac":"56:22:7f:b7:5b:75"},{"name":"eth0","mac":"46:b3:f3:77:bf:21","sandbox":"/var/run/netns/cnitest"}],"ips":[{"version":"4","interface":1,"address":"10.1.1.2/24","gateway":"10.1.1.1"}],"dns":{"nameservers":["10.64.255.25","8.8.8.8"]}},"type":"none"} |
| 63 |
---------------------- |
| 64 |
CmdDel |
| 65 |
ContainerID: cnitool-20c433bb2b1d6ede56d6 |
| 66 |
Netns: /var/run/netns/cnitest |
| 67 |
IfName: eth0 |
| 68 |
Args: |
| 69 |
Path: /opt/cni/bin |
| 70 |
StdinData: {"cniOutput":"/tmp/cni_output.txt","cniVersion":"0.3.1","name":"test","type":"none"} |
| 71 |
---------------------- |
| 72 |
``` |