Skip to content

Commit 98d933d

Browse files
authored
Merge pull request #1222 from M4t7e/kube-proxy-free-cilium
Introducing Cilium 1.15.1 and Full kube-proxy Replacement
2 parents e969085 + 6eaba63 commit 98d933d

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ The default is Flannel, but you can also choose Calico or Cilium, by setting the
170170

171171
As Cilium has a lot of interesting and powerful config possibilities, we give you the ability to configure Cilium with the helm `cilium_values` variable (see the cilium specific [helm values](https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/values.yaml)) before you deploy your cluster.
172172

173+
Cilium supports full kube-proxy replacement. Cilium runs by default in hybrid kube-proxy replacement mode. To achieve a completely kube-proxy-free cluster, set `disable_kube_proxy = true`.
174+
173175
## Scaling Nodes
174176

175177
Two things can be scaled: the number of nodepools or the number of nodes in these nodepools.

control_planes.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ locals {
9191
module.control_planes[keys(module.control_planes)[0]].private_ipv4_address}:6443"
9292
token = local.k3s_token
9393
disable-cloud-controller = true
94+
disable-kube-proxy = var.disable_kube_proxy
9495
disable = local.disable_extras
9596
kubelet-arg = concat(local.kubelet_arg, var.k3s_global_kubelet_args, var.k3s_control_plane_kubelet_args, v.kubelet_args)
9697
kube-controller-manager-arg = local.kube_controller_manager_arg

init.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ resource "null_resource" "first_control_plane" {
3737
token = local.k3s_token
3838
cluster-init = true
3939
disable-cloud-controller = true
40+
disable-kube-proxy = var.disable_kube_proxy
4041
disable = local.disable_extras
4142
kubelet-arg = local.kubelet_arg
4243
kube-controller-manager-arg = local.kube_controller_manager_arg

kube.tf.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ module "kube-hetzner" {
656656
# Please note that if you are getting 403s from Github, it's also useful to set the version manually. However there is rarely a need for that!
657657
# calico_version = "v3.25.0"
658658

659+
# If you want to disable the k3s kube-proxy, use this flag. The default is "false".
660+
# Ensure that your CNI is capable of handling all the functionalities typically covered by kube-proxy.
661+
# disable_kube_proxy = true
662+
659663
# If you want to disable the k3s default network policy controller, use this flag!
660664
# Both Calico and Ciliun cni_plugin values override this value to true automatically, the default is "false".
661665
# disable_network_policy = true

locals.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,23 @@ k8s:
387387
388388
# Replace kube-proxy with Cilium
389389
kubeProxyReplacement: true
390+
%{if var.disable_kube_proxy}
391+
# Enable health check server (healthz) for the kube-proxy replacement
392+
kubeProxyReplacementHealthzBindAddr: "0.0.0.0:10256"
393+
%{endif~}
394+
395+
# Access to Kube API Server (mandatory if kube-proxy is disabled)
396+
k8sServiceHost: "127.0.0.1"
397+
k8sServicePort: "6444"
390398
391399
# Set Tunnel Mode or Native Routing Mode (supported by Hetzner CCM Route Controller)
392400
routingMode: "${var.cilium_routing_mode}"
393401
%{if var.cilium_routing_mode == "native"~}
402+
# Set the native routable CIDR
394403
ipv4NativeRoutingCIDR: "${local.cilium_ipv4_native_routing_cidr}"
404+
405+
# Bypass iptables Connection Tracking for Pod traffic (only works in Native Routing Mode)
406+
installNoConntrackIptablesRules: true
395407
%{endif~}
396408
397409
endpointRoutes:

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,12 @@ variable "placement_group_disable" {
527527
description = "Whether to disable placement groups."
528528
}
529529

530+
variable "disable_kube_proxy" {
531+
type = bool
532+
default = false
533+
description = "Disable kube-proxy in K3s (default false)."
534+
}
535+
530536
variable "disable_network_policy" {
531537
type = bool
532538
default = false
@@ -575,7 +581,7 @@ variable "cilium_values" {
575581

576582
variable "cilium_version" {
577583
type = string
578-
default = "1.14.4"
584+
default = "1.15.1"
579585
description = "Version of Cilium."
580586
}
581587

0 commit comments

Comments
 (0)