Fix rancher-lb LoadBalancer wait-loop in RKE2 scripts

The wait-loop was missing '-o' before the jsonpath template, so
'jsonpath={...}' was parsed as a service name and the query errored
to empty output, causing the loop to never wait. It also queried
.status.conditions[Pending], a shape Services do not have.

Poll the rancher-lb service and block until MetalLB assigns an
external IP instead.
This commit is contained in:
cyberops7
2026-07-08 22:57:55 -06:00
parent af4f57229f
commit 0cb8910004
2 changed files with 2 additions and 2 deletions

View File

@@ -238,7 +238,7 @@ kubectl -n cattle-system get deploy rancher
# Add Rancher LoadBalancer
kubectl get svc -n cattle-system
kubectl expose deployment rancher --name=rancher-lb --port=443 --type=LoadBalancer -n cattle-system
while [[ $(kubectl get svc -n cattle-system 'jsonpath={..status.conditions[?(@.type=="Pending")].status}') = "True" ]]; do
while [[ -z $(kubectl get svc rancher-lb -n cattle-system -o 'jsonpath={.status.loadBalancer.ingress[0].ip}' 2>/dev/null) ]]; do
sleep 5
echo -e " \033[32;5mWaiting for LoadBalancer to come online\033[0m"
done

View File

@@ -256,7 +256,7 @@ kubectl -n cattle-system get deploy rancher
# Add Rancher LoadBalancer
kubectl get svc -n cattle-system
kubectl expose deployment rancher --name=rancher-lb --port=443 --type=LoadBalancer -n cattle-system
while [[ $(kubectl get svc -n cattle-system 'jsonpath={..status.conditions[?(@.type=="Pending")].status}') = "True" ]]; do
while [[ -z $(kubectl get svc rancher-lb -n cattle-system -o 'jsonpath={.status.loadBalancer.ingress[0].ip}' 2>/dev/null) ]]; do
sleep 5
echo -e " \033[32;5mWaiting for LoadBalancer to come online\033[0m"
done