You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.2 KiB

  1. Multus
  2. ===========
  3. Multus is a meta CNI plugin that provides multiple network interface support to
  4. pods. For each interface, Multus delegates CNI calls to secondary CNI plugins
  5. such as Calico, macvlan, etc.
  6. See [multus documentation](https://github.com/intel/multus-cni).
  7. ## Multus installation
  8. Since Multus itself does not implement networking, it requires a master plugin, which is specified through the variable `kube_network_plugin`. To enable Multus an additional variable `kube_network_plugin_multus` must be set to `true`. For example,
  9. ```
  10. kube_network_plugin: calico
  11. kube_network_plugin_multus: true
  12. ```
  13. will install Multus and Calico and configure Multus to use Calico as the primary network plugin.
  14. ## Using Multus
  15. Once Multus is installed, you can create CNI configurations (as a CRD objects) for additional networks, in this case a macvlan CNI configuration is defined. You may replace the config field with any valid CNI configuration where the CNI binary is available on the nodes.
  16. ```
  17. cat <<EOF | kubectl create -f -
  18. apiVersion: "k8s.cni.cncf.io/v1"
  19. kind: NetworkAttachmentDefinition
  20. metadata:
  21. name: macvlan-conf
  22. spec:
  23. config: '{
  24. "cniVersion": "0.3.0",
  25. "type": "macvlan",
  26. "master": "eth0",
  27. "mode": "bridge",
  28. "ipam": {
  29. "type": "host-local",
  30. "subnet": "192.168.1.0/24",
  31. "rangeStart": "192.168.1.200",
  32. "rangeEnd": "192.168.1.216",
  33. "routes": [
  34. { "dst": "0.0.0.0/0" }
  35. ],
  36. "gateway": "192.168.1.1"
  37. }
  38. }'
  39. EOF
  40. ```
  41. You may then create a pod with and additional interface that connects to this network using annotations. The annotation correlates to the name in the NetworkAttachmentDefinition above.
  42. ```
  43. cat <<EOF | kubectl create -f -
  44. apiVersion: v1
  45. kind: Pod
  46. metadata:
  47. name: samplepod
  48. annotations:
  49. k8s.v1.cni.cncf.io/networks: macvlan-conf
  50. spec:
  51. containers:
  52. - name: samplepod
  53. command: ["/bin/bash", "-c", "sleep 2000000000000"]
  54. image: dougbtv/centos-network
  55. EOF
  56. ```
  57. You may now inspect the pod and see that there is an additional interface configured:
  58. ```
  59. $ kubectl exec -it samplepod -- ip a
  60. ```
  61. For more details on how to use Multus, please visit https://github.com/intel/multus-cni