2024-12-19 17:18:36 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-12-27 13:52:01 +01:00
|
|
|
set -e
|
2024-12-19 17:18:36 +01:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
# Check if an argument (IP address) is provided
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Error: Missing argument for the MetalLB IP."
|
|
|
|
echo "Usage: $0 <METALLB_IP>"
|
|
|
|
echo "Please provide an IP address from the MetalLB pool as a parameter."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
METALLB_IP=$1
|
|
|
|
|
|
|
|
# Adding the Traefik Helm repo
|
|
|
|
helm repo add traefik https://traefik.github.io/charts
|
|
|
|
helm repo update
|
|
|
|
|
|
|
|
# Creating the Traefik namespace
|
2024-12-27 13:52:01 +01:00
|
|
|
kubectl create namespace traefik || true
|
2024-12-19 17:18:36 +01:00
|
|
|
# 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
|
2024-12-27 13:52:01 +01:00
|
|
|
helm install traefik traefik/traefik --namespace traefik -f helm-values/traefik.yaml \
|
2024-12-19 17:18:36 +01:00
|
|
|
--set service.type=LoadBalancer \
|
|
|
|
--set service.loadBalancerIP=$METALLB_IP
|