# /infrastructure/controllers/metallb/config-job.yaml apiVersion: batch/v1 kind: Job metadata: name: metallb-config namespace: metallb-system spec: template: spec: serviceAccountName: metallb-config-sa containers: - name: kubectl image: bitnami/kubectl:latest command: - /bin/bash - -c - | # Get the external IP of the node using kubectl SERVER_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}') # Fallback to other address types if ExternalIP isn't available if [ -z "$SERVER_IP" ]; then echo "ExternalIP not found, trying InternalIP..." SERVER_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') fi echo "Detected server IP: $SERVER_IP" if [ -z "$SERVER_IP" ]; then echo "No external IP found for the node" exit 1 fi cat <