mirror of
https://github.com/lordmathis/dev-cluster.git
synced 2025-12-23 09:04:24 +00:00
Add fallback to internal address to metallb config job
This commit is contained in:
@@ -18,8 +18,19 @@ spec:
|
|||||||
# Get the external IP of the node using kubectl
|
# Get the external IP of the node using kubectl
|
||||||
SERVER_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}')
|
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"
|
echo "Detected server IP: $SERVER_IP"
|
||||||
|
|
||||||
|
if [ -z "$SERVER_IP" ]; then
|
||||||
|
echo "No external IP found for the node"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cat <<EOF | kubectl apply -f -
|
cat <<EOF | kubectl apply -f -
|
||||||
apiVersion: metallb.io/v1beta1
|
apiVersion: metallb.io/v1beta1
|
||||||
kind: IPAddressPool
|
kind: IPAddressPool
|
||||||
|
|||||||
Reference in New Issue
Block a user