kube-proxy handles the routing of traffic between pods and services, while Flannel manages the overlay network and ensures that pods can communicate with each other regardless of their physical location in the cluster.
Starting with Talos 1.13, Flannel can be configured to support Network Policies.
Configure Flannel to support network policies
Depending on your Talos version your Flannel CNI can be configured to support Network Policies with the following configuration:- Talos v1.14+
- Talos v1.13
For Talos 1.14 and later, enable Flannel Network Policies using the
KubeFlannelCNIConfig document:Example network policy
In the example below, the network policyallow-api-to-web restricts ingress traffic to pods with the label app: web in the default namespace, allowing only traffic from pods with the label app: api:
app: api can reach port 80 on pods labeled app: web. All other ingress traffic to those pods is denied.
Network policies require
kubeNetworkPoliciesEnabled: true in the Flannel configuration as shown above. Without this setting, NetworkPolicy resources are accepted but not enforced.Customize your Flannel configuration
Most Flannel customization is available directly through theKubeFlannelCNIConfig document — including the backend type, backend port, and MTU. For example, to change the backend from the default VXLAN to host-gw:
KubeFlannelCNIConfig reference for the full set of configurable fields.
If you need to customize Flannel beyond what KubeFlannelCNIConfig exposes, you can deploy a custom Flannel manifest using Omni’s manifest sync feature.
Deploy a fully custom Flannel manifest with Omni
Follow these steps to deploy a custom Flannel manifest through an Omni cluster template: Step 1. Download the upstream Flannel manifest:flannel.yaml to customize the Flannel configuration. For example, to change the backend from VXLAN to host-gw, find the net-conf.json section in the ConfigMap and update it:
none so Talos does not install its own Flannel:
- Talos v1.14+
- Talos < v1.14
For Talos v1.14 and later, disable the default CNI with the
KubeFlannelCNIConfig document:mode: full ensures that Omni continuously syncs the manifest, so any changes you make to the Flannel configuration in the cluster template are applied to the cluster automatically. See Sync Kubernetes Manifests for more details.
Talos Linux ships with all necessary base CNI plugins for Flannel, so a default Flannel installation done by Talos can be replaced with a custom one based on Flannel documentation.