In this guide you will learn how to set up Cilium CNI on Talos.
Cilium can be installed either via theThis documentation will outline installing Cilium CNI v1.18.0 on Talos in six different ways. Adhering to Talos principles we’ll deploy Cilium with IPAM mode set to Kubernetes, and using thecilium
cli or usinghelm
.
cgroupv2
and bpffs
mount that talos already provides.
As Talos does not allow loading kernel modules by Kubernetes workloads, SYS_MODULE
capability needs to be dropped from the Cilium default set of values, this override can be seen in the helm/cilium cli install commands.
Each method can either install Cilium using kube proxy (default) or without: Kubernetes Without kube-proxy
In this guide we assume that KubePrism is enabled and configured to use the port 7445.
patch.yaml
file with the following contents:
patch.yaml
file with the following contents:
Note: It is recommended to template the cilium manifest using helm and use it as part of Talos machine config, but if you want to install Cilium using the Cilium CLI, you can follow the steps below.Install the Cilium CLI following the steps here.
Note: If you plan to use gRPC and GRPCRoutes with TLS, you must enable ALPN by setting gatewayAPI.enableAlpn=true
.
Since gRPC relies on HTTP/2, ALPN is required to negotiate HTTP/2 support between the client and server.
cilium.yaml
using helm template
, instead of applying this manifest directly during the Talos boot window (before the reboot timeout).
You can also host this file somewhere and patch the machine config to apply this manifest automatically during bootstrap.
To do this patch your machine configuration to include this config instead of the above:
Create a patch.yaml
file with the following contents:
helm template
output manifest inside the machine configuration.
The machine config should be generated with CNI set to none
Create a patch.yaml
file with the following contents:
kube-proxy
disabled, you can also include the following:
Create a patch.yaml
file with the following contents:
talosctl upgrade-k8s
as it will take care of updating inline manifests.forwardKubeDNSToHost=true
option (which is enabled by default) in combination with cilium bpf.masquerade=true
.
There is a known issue that causes CoreDNS
to not work correctly.
As a workaround, configuring forwardKubeDNSToHost=false
resolves the issue.
For more details see the discusssion here
cilium connectivity test
might hang and/or fail with errors similar to
Error creating: pods "client-69748f45d8-9b9jg" is forbidden: violates PodSecurity "baseline:latest": non-default capabilities (container "client" must not include "NET_RAW" in securityContext.capabilities.add)
This is expected, you can workaround it by adding the pod-security.kubernetes.io/enforce=privileged
label on the namespace level.