Skip to content

Commit

Permalink
Merge pull request #35 from twelho/netkit
Browse files Browse the repository at this point in the history
feat: add Cilium netkit device mode support
  • Loading branch information
twelho authored Jan 29, 2025
2 parents 74e04a1 + 659d380 commit 887a537
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"ipv4-cidr": str_schema,
"direct-routes": bool,
},
Optional("netkit"): bool,
Optional("bgp"): {
"enabled": bool,
},
Expand Down Expand Up @@ -423,7 +424,6 @@ def apply_configuration(node_set, configuration_file, global_patches):
"ipam.mode=kubernetes",
"kubeProxyReplacement=true",
"bpf.masquerade=true", # eBPF-based masquerading
# "bpf.datapathMode=netkit", # netkit device mode, requires kernel 6.8 (not yet in Talos)
"securityContext.capabilities.ciliumAgent={CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,"
"SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}",
"securityContext.capabilities.cleanCiliumState={NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}",
Expand Down Expand Up @@ -499,6 +499,11 @@ def apply_configuration(node_set, configuration_file, global_patches):
f"autoDirectNodeRoutes={'true' if native_routing["direct-routes"] else 'false'}",
]

if config["cluster"]["cilium"].get("netkit"):
cilium_opts += [
"bpf.datapathMode=netkit", # netkit device mode, REQUIRES kernel >= 6.8 (Talos v1.9)
]

if bgp := config["cluster"]["cilium"].get("bgp"):
if bgp["enabled"]:
cilium_opts += [
Expand Down
4 changes: 4 additions & 0 deletions clusters/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ cluster:
enabled: true # Enable Cilium native routing datapath
ipv4-cidr: 10.244.0.0/16 # IPv4 CIDR used for native routing
direct-routes: true # Enable if you have L2 connectivity between all nodes
# Enable Cilium netkit device mode instead of veth (optional)
# WARNING: REQUIRES kernel 6.8 or newer (Talos v1.9), cluster WILL BECOME INACCESSIBLE if enabled on older kernels!
# For details, see https://docs.cilium.io/en/latest/operations/performance/tuning/#netkit-device-mode
netkit: true
bgp: # Configure Cilium BGP Control Plane support (optional)
enabled: true # Enable Cilium BGP Control Plane
sops: my-cluster.example.com # GPG ID/fingerprint of Mozilla SOPS key (https://github.com/mozilla/sops) (optional)
Expand Down

0 comments on commit 887a537

Please sign in to comment.