From 6e543dbe6e0112ca3fbdc9948b1d4930e995f7cd Mon Sep 17 00:00:00 2001 From: "Guillaume B.B. Van Hemmen" Date: Fri, 27 Dec 2024 13:52:01 +0100 Subject: [PATCH] #0000 - Add custom node selectors and tolerations for Traefik deployment This commit introduces a Helm values file for Traefik to define node selectors and tolerations for targeting specific nodes. The installation script is updated to use the new values file, allowing more precise scheduling of Traefik pods. Additionally, a safeguard is added to namespace creation to prevent errors if it already exists. --- helm-values/traefik.yaml | 8 ++++++++ scripts/01_install_traefik.sh | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 helm-values/traefik.yaml mode change 100644 => 100755 scripts/01_install_traefik.sh diff --git a/helm-values/traefik.yaml b/helm-values/traefik.yaml new file mode 100644 index 0000000..9babe00 --- /dev/null +++ b/helm-values/traefik.yaml @@ -0,0 +1,8 @@ +nodeSelector: + com.van-hemmen.role: gateway + com.van-hemmen.hosting: ovh +tolerations: + - key: "com.van-hemmen.role" + operator: "Equal" + value: "gateway" + effect: "NoSchedule" diff --git a/scripts/01_install_traefik.sh b/scripts/01_install_traefik.sh old mode 100644 new mode 100755 index fe070f6..cd435c4 --- a/scripts/01_install_traefik.sh +++ b/scripts/01_install_traefik.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -ex +set -e # This script installs Traefik using Helm, with MetalLB load balancer configuration. # Ensure you pass the IP from the MetalLB pool as an argument when running the script. @@ -20,11 +20,11 @@ helm repo add traefik https://traefik.github.io/charts helm repo update # Creating the Traefik namespace -kubectl create namespace traefik +kubectl create namespace traefik || true # Uncomment the line below to enable privileged pod security policy for the namespace kubectl label namespace traefik pod-security.kubernetes.io/enforce=privileged # Installing Traefik with the MetalLB IP specified -helm install traefik traefik/traefik --namespace traefik \ +helm install traefik traefik/traefik --namespace traefik -f helm-values/traefik.yaml \ --set service.type=LoadBalancer \ --set service.loadBalancerIP=$METALLB_IP