A CNI meta-plugin for multi-homed pods in Kubernetes
Go to file
Dan Williams d9c06e99d1 server: don't set CNI config readinessindicatorfile when using ConfigManager
For whatever reason calling os.Stat() on the readiness indicator file
from CmdAdd()/CmdDel() when multus is running in server mode and is
containerized often returns "file not found", which triggers the
polling behavior of GetReadinessIndicatorFile(). This greatly delays
CNI operations that should be pretty quick. Even if an exponential
backoff is used, os.Stat() can still return "file not found"
multiple times, even though the file clearly exists.

But it turns out we don't need to check the readiness file in server
mode when running with MultusConfigFile == "auto". In this mode the
server starts the ConfigManager which (a) waits until the file exists
and (b) fsnotify watches the readiness and (c) exits the daemon
immediately if the file is deleted or moved.

This means we can assume that while the daemon is running and the
server is handling CNI requests that the readiness file exists;
otherwise the daemon would have exited. Thus CmdAdd/CmdDel don't
need to run a lot of possibly failing os.Stat() calls in the CNI
hot paths.

Signed-off-by: Dan Williams <dcbw@redhat.com>
2023-09-14 08:58:19 -05:00
.github github: export and upload e2e test kind logs (#1157) 2023-09-13 21:51:58 +09:00
cmd server: don't set CNI config readinessindicatorfile when using ConfigManager 2023-09-14 08:58:19 -05:00
deployments server: use a shared informer pod cache rather than direct apiserver access 2023-09-14 08:57:12 -05:00
docs Change gopkg.in to v4 for v4 release 2023-04-13 23:36:40 +09:00
e2e server: use a shared informer pod cache rather than direct apiserver access 2023-09-14 08:57:12 -05:00
examples Fix typos 2021-09-14 00:25:01 +09:00
hack Merge pull request #1145 from s1061123/refine-build 2023-08-25 11:06:37 -04:00
images Refine dockerfile to use buildx multi-arch image for thin plugin (#1070) 2023-04-13 23:15:00 +09:00
pkg server: don't set CNI config readinessindicatorfile when using ConfigManager 2023-09-14 08:58:19 -05:00
vendor vendor: add client-go and more apimachinery modules 2023-09-13 07:54:41 -05:00
.gitignore Support CNI 1.0.0 2022-04-06 00:34:53 +09:00
.goreleaser.yml Change gopkg.in to v4 for v4 release 2023-04-13 23:36:40 +09:00
.travis.yml Restructured multus to use Go standard project layout. 2020-12-16 22:38:10 +09:00
CODE_OF_CONDUCT.md Adds code of conduct 2020-06-05 09:18:10 +09:00
CONTRIBUTING.md Update CONTRIBUTING.md 2017-09-26 13:53:10 +01:00
go.mod vendor: add client-go and more apimachinery modules 2023-09-13 07:54:41 -05:00
go.sum Bump google.golang.org/grpc from 1.40.0 to 1.53.0 (#1120) 2023-07-20 23:37:26 +09:00
LICENSE Initial commit 2016-12-13 14:48:12 +00:00
NOTICE Add NOTICE (#967) 2022-12-08 23:50:37 +09:00
README.md Adds permanent slack invite (#1083) 2023-04-27 23:07:48 +09:00

Multus-CNI

multus-cni Logo

BuildTestGo Report CardCoverage Status

Multus CNI enables attaching multiple network interfaces to pods in Kubernetes.

How it works

Multus CNI is a container network interface (CNI) plugin for Kubernetes that enables attaching multiple network interfaces to pods. Typically, in Kubernetes each pod only has one network interface (apart from a loopback) -- with Multus you can create a multi-homed pod that has multiple interfaces. This is accomplished by Multus acting as a "meta-plugin", a CNI plugin that can call multiple other CNI plugins.

Multus CNI follows the Kubernetes Network Custom Resource Definition De-facto Standard to provide a standardized method by which to specify the configurations for additional network interfaces. This standard is put forward by the Kubernetes Network Plumbing Working Group.

Multus is one of the projects in the Baremetal Container Experience kit

Multi-Homed pod

Here's an illustration of the network interfaces attached to a pod, as provisioned by Multus CNI. The diagram shows the pod with three interfaces: eth0, net0 and net1. eth0 connects kubernetes cluster network to connect with kubernetes server/services (e.g. kubernetes api-server, kubelet and so on). net0 and net1 are additional network attachments and connect to other networks by using other CNI plugins (e.g. vlan/vxlan/ptp).

multus-pod-image

Quickstart Installation Guide

The quickstart installation method for Multus requires that you have first installed a Kubernetes CNI plugin to serve as your pod-to-pod network, which we refer to as your "default network" (a network interface that every pod will be created with). Each network attachment created by Multus will be in addition to this default network interface. For more detail on installing a default network CNI plugin, refer to our quick-start guide.

Clone this GitHub repository, and apply a daemonset which installs Multus using kubectl. From the root directory of the clone, apply the daemonset YAML file:

cat ./deployments/multus-daemonset-thick.yml | kubectl apply -f -

This will configure your systems to be ready to use Multus CNI, but, to get started with adding additional interfaces to your pods, refer to our complete quick-start guide

Thin Plugin v.s Thick Plugin

With the multus 4.0 release, we introduce a new client/server-style plugin deployment. This new deployment is called 'thick plugin', in contrast to deployments in previous versions, which is now called a 'thin plugin'. The new thick plugin consists of two binaries, multus-daemon and multus-shim CNI plugin. The 'multus-daemon' will be deployed to all nodes as a local agent and supports additional features, such as metrics, which were not available with the 'thin plugin' deployment before. Due to these additional features, the 'thick plugin' comes with the trade-off of consuming more resources than the 'thin plugin'.

We recommend using the thick plugin in most environments, but if you wish to run the thin plugin, or are in a resource-constrained environment, you may do so with:

cat ./deployments/multus-daemonset.yml | kubectl apply -f -

Additional Installation Options

In addition to the quick-start guide, you may:

Comprehensive Documentation

Contact Us

For any questions about Multus CNI, open up a GitHub issue or feel free to ask a question in #general in the NPWG Slack.

To be invited, use this slack invite link.