The Istio CNI node agent is used to configure traffic redirection for pods in the mesh. It runs as a DaemonSet, on every node, with elevated permissions. The Istio CNI node agent can be used in two Istio data plane modes.
For the sidecar data plane mode, the Istio CNI node agent is optional. It removes the requirement of running privileged init containers in every pod in the mesh, replacing that model with a single privileged node agent pod on each Kubernetes node.
The Istio CNI node agent is required in the ambient data plane mode.
This document is focused on using the Istio CNI node agent as an optional part of the sidecar data plane mode.
If you are creating a service mesh in an OpenShift cluster, Istio CNI is enabled by default, so you do not need to follow the steps in this document.
NET_ADMIN
and NET_RAW
permissions in business workloads)KIND
)First, install the service mesh as usual. After installation, do not add any services (i.e., do not inject the Sidecar) for the time being. Then follow the steps below to install and configure Istio CNI.
In most environments, a basic Istio cluster with the istioCni component enabled can be installed using the following commands:
kube-system
namespace.When using OpenShift or Multus CNI:
false
.multus
.info
)/opt/cni/bin
)/etc/cni/net.d
)/var/run/netns
, in minikube/docker/others can be /var/run/docker/netns
)true
) or as standalone files in the conf dir (value false
).default
and multus
. (Default: default
)Ensure all CNI node agent pods are int the Running state proceeding to the next step.
By default, Istio uses a webhook to inject the istio-init
container for transparent traffic interception.
To use Istio CNI instead of the istio-init
container, we need to adjust ServiceMesh resource as follows:
istio-init
container. (Default: false
)multus
if Multus CNI is used. (Default: default
)After installation and configuration, use the normal service injection process without any additional changes.
After Istio CNI component is installed and properly configured, the following changes will be made to the pods:
istio-init
container will no longer be present (transparent traffic interception will be handled by the Istio CNI node agent).istio-validation
that checks if the iptables rules for transparent traffic interception are successfully set.The Istio CNI DaemonSet installs the CNI network plugin on every node. However, a time gap exists between when the
DaemonSet pod gets scheduled onto a node, and the CNI plugin is installed and ready to be used.
There is a chance that an application pod starts up during that time gap, and the kubelet
has no knowledge of
the Istio CNI plugin.
The result is that the application pod comes up without Istio traffic redirection and bypasses Istio sidecar.
To mitigate the race between an application pod and the Istio CNI DaemonSet, an istio-validation
init container
is added as part of the sidecar injection, which detects if traffic redirection is set up correctly, and blocks the
pod starting up if not.
The CNI DaemonSet will detect and handle any pod stuck in such state; how the pod is handled is dependent on
configuration described below.
This mitigation is enabled by default and can be turned off by setting cni.values.repair.enabled
to false
.
true
)true
)false
)cni.istio.io/uninitialized=true
. User will need to take manual action to resolve. (Default: false
)Configuration Priority: repairPods
> deletePods
> labelPods
. So the first true
field with higher priority will be used.
For example, to make deletePods
take effect, Set true
to deletePods
is not sufficient, set false
to repairPods
is also required.