#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.
This commit is contained in:
Guillaume "B.B." Van Hemmen 2024-12-27 13:52:01 +01:00
parent 5e81dc3eba
commit 6e543dbe6e
2 changed files with 11 additions and 3 deletions

8
helm-values/traefik.yaml Normal file
View file

@ -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"

6
scripts/01_install_traefik.sh Normal file → Executable file
View file

@ -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