Skip to content

Commit

Permalink
Update CNI plugin docs
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Feb 3, 2025
1 parent 8e91692 commit 067d74f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
46 changes: 31 additions & 15 deletions docs/networking/basic_network_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
title: Network Options
---

Kubernetes requires installation of one or more CNI plugins to provide Pod networking. RKE2 includes support for five CNIs: Canal, Cilium, Calico, Flannel, and Multus. Only Calico and Flannel support Microsoft Windows. Multus is a secondary CNI Plugin, and must be enabled alongside a primary CNI Plugin. For more information, see the [Multus and SR-IOV](multus_sriov.md) documentation.
Kubernetes requires installation of one or more CNI Plugins to provide Pod networking. RKE2 bundles four primary CNI Plugins: Canal, Cilium, Calico, and Flannel. Only Calico and Flannel support Microsoft Windows. RKE2 also includes Multus as a secondary CNI Plugin, which must be enabled alongside a primary CNI Plugin. For more information, see the [Multus and SR-IOV](multus_sriov.md) documentation.

Canal is the default CNI Plugin, but all bundled plugins are supported. Bundled CNI Plugins are installed via Helm chart, and can be customized by depolying a HelmChartConfig with customized values. For more information on using HelmChartConfig resources, see the [Helm Integration](../helm.md) documentation, and the CNI-specific examples provided below.
Canal is the default CNI Plugin, but all bundled plugins are supported. Bundled CNI Plugins are installed via Helm chart, and can be customized by deploying a HelmChartConfig with additional chart values. For more information on using HelmChartConfig resources, see the [Helm Integration](../helm.md) documentation, and the CNI-specific examples provided below.

## Select a CNI plugin
## Select a CNI Plugin

Use the `cni` [configuration file key](../install/configuration.md) to select the CNI Plugin you wish to use. If you do not want to use any of the bundled CNI Plugins, you can set `cni` to `none`. Note that nodes will remain NotReady and be tainted unschedulable until a CNI Plugin is installed.

```yaml
# /etc/rancher/rke2/config.yaml
cni: canal
```
Expand All @@ -21,7 +22,7 @@ To customize the Helm chart values for a bundled CNI Plugin chart, you must crea
Default chart values can be found by browsing the [RKE2 charts repository](https://github.com/rancher/rke2-charts/tree/main/charts), and referencing `values.yaml` for the version of the chart bundled with your RKE2 version.

<Tabs groupId = "CNIplugin" queryString>
<TabItem value="Canal CNI plugin" default>
<TabItem value="Canal CNI Plugin" default>

Canal uses Flannel for inter-node traffic and Calico for intra-node traffic and network policies. By default, it will use vxlan encapsulation to create an overlay network among nodes. For example, to override the flannel interface, you can apply the following chart values:

Expand Down Expand Up @@ -67,10 +68,10 @@ Canal requires the iptables or xtables-nft package to be installed on the node.
Canal is currently not supported on clusters with Windows nodes.
:::

Please check [Known issues and Limitations](../known_issues.md) if you experience IP allocation problems
Please check [Known issues and Limitations](../known_issues.md) if you experience IP allocation problems.

</TabItem>
<TabItem value="Cilium CNI plugin" default>
<TabItem value="Cilium CNI Plugin" default>

When using Cilium, you must wnsure that nodes have a supported kernel version (>= 4.9.17) and they meet the [requirements](https://docs.cilium.io/en/stable/operations/system_requirements/). To override the default options, please use a HelmChartConfig resource. The HelmChartConfig resource must match the name and namespace of its corresponding HelmChart. For example, to enable eni:

Expand Down Expand Up @@ -135,7 +136,7 @@ Cilium is currently not supported on Windows.
:::

</TabItem>
<TabItem value="Calico CNI plugin" default>
<TabItem value="Calico CNI Plugin" default>
For example, to change the interface MTU, you can use the following chart values:

```yaml
Expand Down Expand Up @@ -176,13 +177,28 @@ Calico requires the iptables or xtables-nft package to be installed on the node
:::

</TabItem>
<TabItem value="Flannel CNI plugin" default>
Starting with RKE2 2024 Feb release (v1.29.2, v1.28.7, v1.27.11, v1.26.14), Flannel can be deployed as the CNI plugin.

<TabItem value="Flannel CNI Plugin" default>
:::note
Flannel is available as of February 2024 releases: v1.29.2, v1.28.7, v1.27.11, v1.26.14.
Only the `vxlan` backend is supported.
:::

For example, to change the interface MTU, you can use the following chart values:

```yaml
# /var/lib/rancher/rke2/server/manifests/rke2-flannel-config.yaml
---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: rke2-flannel
namespace: kube-system
spec:
valuesContent: |-
flannel:
mtu: 9000
```

:::warning
Flannel does not support network policies. Therefore, it is not recommended for hardened installations.
:::
Expand All @@ -204,24 +220,24 @@ cluster-cidr: "10.42.0.0/16,2001:cafe:42::/56"
service-cidr: "10.43.0.0/16,2001:cafe:43::/112"
```

Each CNI plugin may require a different configuration for dual-stack:
Each CNI Plugin may require a different configuration for dual-stack:

<Tabs groupId = "CNIplugin" queryString>
<TabItem value="Canal CNI plugin" default>
<TabItem value="Canal CNI Plugin" default>

Canal automatically detects the RKE2 configuration for dual-stack and does not need any extra configuration. Dual-stack is currently not supported in the windows installations of RKE2.

</TabItem>
<TabItem value="Cilium CNI plugin" default>
<TabItem value="Cilium CNI Plugin" default>

Cilium automatically detects the RKE2 configuration for dual-stack and does not need any extra configuration.

</TabItem>
<TabItem value="Calico CNI plugin" default>
<TabItem value="Calico CNI Plugin" default>

Calico automatically detects the RKE2 configuration for dual-stack and does not need any extra configuration. When deployed in dual-stack mode, it creates two different ippool resources. Note that when using dual-stack, calico leverages BGP instead of VXLAN encapsulation. Dual-stack and BGP are currently not supported in the windows installations of RKE2.
</TabItem>
<TabItem value="Flannel CNI plugin" default>
<TabItem value="Flannel CNI Plugin" default>

Flannel automatically detects the RKE2 configuration for dual-stack and does not need any extra configuration.

Expand Down
20 changes: 9 additions & 11 deletions docs/networking/multus_sriov.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ title: Multus and SR-IOV

## Using Multus

[Multus CNI](https://github.com/k8snetworkplumbingwg/multus-cni) is a CNI plugin that enables attaching multiple network interfaces to pods. Multus does not replace CNI plugins, instead it acts as a CNI plugin multiplexer. Multus is useful in certain use cases, especially when pods are network intensive and require extra network interfaces that support dataplane acceleration techniques such as SR-IOV.
[Multus CNI](https://github.com/k8snetworkplumbingwg/multus-cni) is a CNI Plugin that enables attaching multiple network interfaces to pods. Multus does not replace CNI Plugins, instead it acts as a CNI Plugin multiplexer. Multus is useful in certain use cases, especially when pods are network intensive and require extra network interfaces that support dataplane acceleration techniques such as SR-IOV.

Multus can not be deployed standalone. It always requires at least one conventional CNI plugin that fulfills the Kubernetes cluster network requirements. That CNI plugin becomes the default for Multus, and will be used to provide the primary interface for all pods.
Multus can not be deployed standalone. It always requires at least one conventional CNI Plugin that fulfills the Kubernetes cluster network requirements. That CNI Plugin becomes the default for Multus, and will be used to provide the primary interface for all pods.

To enable Multus, add multus as the first list entry in the cni config key, followed by the name of the plugin you want to use alongside Multus (or `none` if you will provide your own default plugin). Note that multus must always be in the first position of the list. For example, to use Multus with canal as the default plugin you could specify:
To enable Multus, specify `multus` as the first list entry in the `cni` configuration file key, followed by the name of the plugin you want to use alongside Multus (or `none` if you will provide your own default plugin). Note that multus must always be in the first position of the list. For example, to use Multus with Canal as the primary CNI Plugin:

```yaml
# /etc/rancher/rke2/config.yaml
Expand All @@ -18,8 +18,6 @@ cni:
- canal
```
This can also be specified with command-line arguments, i.e. `--cni=multus,canal` or `--cni=multus --cni=canal`.

For more information about Multus, refer to the [multus-cni](https://github.com/k8snetworkplumbingwg/multus-cni/tree/master/docs) documentation.
## Using Multus with Cilium
Expand All @@ -43,17 +41,17 @@ spec:

## Using Multus with the containernetworking plugins

Any CNI plugin can be used as secondary CNI plugin for Multus to provide additional network interfaces attached to a pod. However, it is most common to use the CNI plugins maintained by the containernetworking team (bridge, host-device, macvlan, etc) as secondary CNI plugins for Multus. These containernetworking plugins are automatically deployed when installing Multus. For more information about these plugins, refer to the [containernetworking plugins](https://www.cni.dev/plugins/current) documentation.
Any CNI Plugin can be used as secondary CNI Plugin for Multus to provide additional network interfaces attached to a pod. However, it is most common to use the CNI Plugins maintained by the Kubernetes ContainerNetworking team (bridge, host-device, macvlan, etc) as secondary CNI Plugins for Multus. The Kubernetes ContainerNetworking team plugins are automatically deployed when installing Multus. For more information about these plugins, refer to the [ContainerNetworking Plugins](https://www.cni.dev/plugins/current) documentation.

To use any of these plugins, a proper NetworkAttachmentDefinition object will need to be created to define the configuration of the secondary network. The definition is then referenced by pod annotations, which Multus will use to provide extra interfaces to that pod. An example using the macvlan cni plugin with Multus is available [in the multus-cni repo](https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/docs/quickstart.md#storing-a-configuration-as-a-custom-resource).
To use any of these plugins, a proper NetworkAttachmentDefinition object will need to be created to define the configuration of the secondary network. The definition is then referenced by pod annotations, which Multus will use to provide extra interfaces to that pod. An example using the `macvlan` CNI Pllugin with Multus is available [in the multus-cni repo](https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/docs/quickstart.md#storing-a-configuration-as-a-custom-resource).

## Multus IPAM plugin options

<Tabs groupId = "MultusIPAMplugins">
<TabItem value="host-local" default>
host-local IPAM plugin allocates ip addresses out of a set of address ranges. It stores the state locally on the host filesystem, therefore ensuring uniqueness of IP addresses on a single host. Therefore, we don't recommend it for multi-node clusters. This IPAM plugin does not require any extra deployment. For more information: https://www.cni.dev/plugins/current/ipam/host-local/.
</TabItem>
<TabItem value="Multus DHCP daemon" default>
<TabItem value="Multus DHCP daemon">

Multus provides an optional daemonset to deploy the DHCP daemon required to run the [DHCP IPAM plugin](https://www.cni.dev/plugins/current/ipam/dhcp/).

Expand All @@ -77,9 +75,9 @@ This feature is available starting with the 2024-01 releases (v1.29.1+rke2r1, v1

NOTE: You should write this file before starting rke2.
</TabItem>
<TabItem value="Whereabouts" default>
<TabItem value="Whereabouts">

[Whereabouts](https://github.com/k8snetworkplumbingwg/whereabouts) is an IP Address Management (IPAM) CNI plugin that assigns IP addresses cluster-wide.
[Whereabouts](https://github.com/k8snetworkplumbingwg/whereabouts) is an IP Address Management (IPAM) CNI Plugin that assigns IP addresses cluster-wide.
RKE2 includes the option to use Whereabouts with Multus to manage the IP addresses of the additional interfaces created through Multus.
In order to do this, you need to use [HelmChartConfig](../helm.md#customizing-packaged-components-with-helmchartconfig) to configure the Multus CNI to use Whereabouts.

Expand Down Expand Up @@ -114,7 +112,7 @@ that must be fulfilled to consider the node as SR-IOV capable:
* The host operating system must activate IOMMU virtualization
* The host operating system includes drivers capable of doing sriov (e.g. i40e, vfio-pci, etc)

The SR-IOV CNI plugin cannot be used as the default CNI plugin for Multus; it must be deployed alongside both Multus and a traditional CNI plugin. The SR-IOV CNI helm chart can be found in the `rancher-charts` Helm repo. For more information see [Rancher Helm Charts documentation](https://ranchermanager.docs.rancher.com/pages-for-subheaders/helm-charts-in-rancher).
The SR-IOV CNI Plugin cannot be used as the default CNI Plugin for Multus; it must be deployed alongside both Multus and a traditional CNI Plugin. The SR-IOV CNI helm chart can be found in the `rancher-charts` Helm repo. For more information see [Rancher Helm Charts documentation](https://ranchermanager.docs.rancher.com/pages-for-subheaders/helm-charts-in-rancher).

After installing the SR-IOV CNI chart, the SR-IOV operator will be deployed. Then, the user must specify what nodes in the cluster are SR-IOV capable by labeling them with `feature.node.kubernetes.io/network-sriov.capable=true`:

Expand Down

0 comments on commit 067d74f

Please sign in to comment.