#!/bin/bash # Configure HAProxy Load Balancers for AiWorker K3s Cluster set -e GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' echo -e "${GREEN}๐Ÿ”ง Configuring Load Balancers${NC}" LB_IPS=("108.165.47.221" "108.165.47.203") LB_NAMES=("k8s-lb-01" "k8s-lb-02") # Get Nginx Ingress NodePort ports echo -e "\n${YELLOW}Getting Nginx Ingress NodePorts...${NC}" HTTP_PORT=$(kubectl --kubeconfig ~/.kube/aiworker-config get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.spec.ports[?(@.port==80)].nodePort}') HTTPS_PORT=$(kubectl --kubeconfig ~/.kube/aiworker-config get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.spec.ports[?(@.port==443)].nodePort}') echo " HTTP NodePort: ${HTTP_PORT}" echo " HTTPS NodePort: ${HTTPS_PORT}" # Create HAProxy configuration cat > /tmp/haproxy.cfg <