diff --git a/assets/charts/control-plane/kubernetes/templates/kube-proxy.yaml b/assets/charts/control-plane/kubernetes/templates/kube-proxy.yaml index c00556f3c..811181f97 100644 --- a/assets/charts/control-plane/kubernetes/templates/kube-proxy.yaml +++ b/assets/charts/control-plane/kubernetes/templates/kube-proxy.yaml @@ -42,6 +42,9 @@ spec: - --proxy-mode=iptables - --metrics-bind-address=$(HOST_IP) - --healthz-bind-address=$(HOST_IP) + {{- if not (eq (int .Values.kubeProxy.conntrackMaxPerCore) 32768) }} + - --conntrack-max-per-core={{ .Values.kubeProxy.conntrackMaxPerCore }} + {{- end }} env: - name: NODE_NAME valueFrom: diff --git a/assets/charts/control-plane/kubernetes/values.yaml b/assets/charts/control-plane/kubernetes/values.yaml index f17890278..ab4328298 100644 --- a/assets/charts/control-plane/kubernetes/values.yaml +++ b/assets/charts/control-plane/kubernetes/values.yaml @@ -12,6 +12,7 @@ kubeProxy: image: k8s.gcr.io/kube-proxy:v1.19.3 podCIDR: 10.2.0.0/16 trustedCertsDir: /usr/share/ca-certificates + conntrackMaxPerCore: 32768 kubeScheduler: image: k8s.gcr.io/kube-scheduler:v1.19.3 controlPlaneReplicas: 1 diff --git a/assets/terraform-modules/aws/flatcar-linux/kubernetes/bootkube.tf b/assets/terraform-modules/aws/flatcar-linux/kubernetes/bootkube.tf index aaf97d0b3..be65162c9 100644 --- a/assets/terraform-modules/aws/flatcar-linux/kubernetes/bootkube.tf +++ b/assets/terraform-modules/aws/flatcar-linux/kubernetes/bootkube.tf @@ -33,4 +33,6 @@ module "bootkube" { encrypt_pod_traffic = var.encrypt_pod_traffic ignore_x509_cn_check = var.ignore_x509_cn_check + + conntrack_max_per_core = var.conntrack_max_per_core } diff --git a/assets/terraform-modules/aws/flatcar-linux/kubernetes/variables.tf b/assets/terraform-modules/aws/flatcar-linux/kubernetes/variables.tf index bf3059a66..516649577 100644 --- a/assets/terraform-modules/aws/flatcar-linux/kubernetes/variables.tf +++ b/assets/terraform-modules/aws/flatcar-linux/kubernetes/variables.tf @@ -196,3 +196,8 @@ variable "ignore_x509_cn_check" { type = bool default = false } + +variable "conntrack_max_per_core" { + description = "--conntrack-max-per-core value for kube-proxy. Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min)." + type = number +} diff --git a/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/bootkube.tf b/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/bootkube.tf index 53e8230b7..b283ed088 100644 --- a/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/bootkube.tf +++ b/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/bootkube.tf @@ -26,4 +26,6 @@ module "bootkube" { encrypt_pod_traffic = var.encrypt_pod_traffic ignore_x509_cn_check = var.ignore_x509_cn_check + + conntrack_max_per_core = var.conntrack_max_per_core } diff --git a/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/variables.tf b/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/variables.tf index aaef0937a..f092b9f92 100644 --- a/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/variables.tf +++ b/assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/variables.tf @@ -195,3 +195,8 @@ variable "ignore_x509_cn_check" { type = bool default = false } + +variable "conntrack_max_per_core" { + description = "--conntrack-max-per-core value for kube-proxy. Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min)." + type = number +} diff --git a/assets/terraform-modules/bootkube/assets.tf b/assets/terraform-modules/bootkube/assets.tf index d56788c45..57f69b94f 100644 --- a/assets/terraform-modules/bootkube/assets.tf +++ b/assets/terraform-modules/bootkube/assets.tf @@ -82,6 +82,7 @@ resource "local_file" "kubernetes" { serviceaccount_key = base64encode(tls_private_key.service-account.private_key_pem) etcd_endpoints = var.etcd_endpoints enable_tls_bootstrap = var.enable_tls_bootstrap + conntrack_max_per_core = var.conntrack_max_per_core }) } diff --git a/assets/terraform-modules/bootkube/resources/charts/kubernetes.yaml b/assets/terraform-modules/bootkube/resources/charts/kubernetes.yaml index 8757d7ffe..cf30acf06 100644 --- a/assets/terraform-modules/bootkube/resources/charts/kubernetes.yaml +++ b/assets/terraform-modules/bootkube/resources/charts/kubernetes.yaml @@ -12,6 +12,7 @@ kubeProxy: image: ${kube_proxy_image} podCIDR: ${pod_cidr} trustedCertsDir: ${trusted_certs_dir} + conntrackMaxPerCore: ${conntrack_max_per_core} kubeScheduler: image: ${kube_scheduler_image} controlPlaneReplicas: ${control_plane_replicas} diff --git a/assets/terraform-modules/bootkube/variables.tf b/assets/terraform-modules/bootkube/variables.tf index d04fdd322..04fac6d18 100644 --- a/assets/terraform-modules/bootkube/variables.tf +++ b/assets/terraform-modules/bootkube/variables.tf @@ -185,3 +185,8 @@ variable "encrypt_pod_traffic" { type = bool default = false } + +variable "conntrack_max_per_core" { + description = "--conntrack-max-per-core value for kube-proxy. Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min)." + type = number +} diff --git a/assets/terraform-modules/packet/flatcar-linux/kubernetes/bootkube.tf b/assets/terraform-modules/packet/flatcar-linux/kubernetes/bootkube.tf index 07e18cb83..3afa5e0d3 100644 --- a/assets/terraform-modules/packet/flatcar-linux/kubernetes/bootkube.tf +++ b/assets/terraform-modules/packet/flatcar-linux/kubernetes/bootkube.tf @@ -48,4 +48,6 @@ module "bootkube" { encrypt_pod_traffic = var.encrypt_pod_traffic ignore_x509_cn_check = var.ignore_x509_cn_check + + conntrack_max_per_core = var.conntrack_max_per_core } diff --git a/assets/terraform-modules/packet/flatcar-linux/kubernetes/variables.tf b/assets/terraform-modules/packet/flatcar-linux/kubernetes/variables.tf index 43b2db089..b48ed4dbc 100644 --- a/assets/terraform-modules/packet/flatcar-linux/kubernetes/variables.tf +++ b/assets/terraform-modules/packet/flatcar-linux/kubernetes/variables.tf @@ -213,3 +213,8 @@ variable "ignore_x509_cn_check" { type = bool default = false } + +variable "conntrack_max_per_core" { + description = "--conntrack-max-per-core value for kube-proxy. Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min)." + type = number +} diff --git a/ci/aws/aws-cluster.lokocfg.envsubst b/ci/aws/aws-cluster.lokocfg.envsubst index 24e11fb38..bf0428c30 100644 --- a/ci/aws/aws-cluster.lokocfg.envsubst +++ b/ci/aws/aws-cluster.lokocfg.envsubst @@ -42,8 +42,9 @@ EOF instance_type = "i3.large" spot_price = "0.08" labels = { - "testing.io" = "yes", - "roleofnode" = "testing", + "testing.io" = "yes", + "roleofnode" = "testing", + "conntrack-modified" = "true", } tags = { "deployment" = "ci" @@ -62,6 +63,24 @@ storage: group: id: 500 EOF + , + <