How can I wait for a LoadBalancer service to have an external IP assigned? I found a few stackoverlow questions relating to this, but those were written before the kubectl wait command could wait for an arbitrary jsonpath.
From what I understand, the command would look something like this, however according to the wait documentation, I need a JSONPath expression to compare against, and I don't know how to simply check if a field exists
I understand my command would look something like this
kubectl wait service/service-name --for=jsonpath='{.status.loadBalancer.ingress[0].ip}'
However, i get the following error due to there being no condition specified:
error: jsonpath wait format must be --for=jsonpath='{.status.readyReplicas}'=3
I've tested it and it works if I put in a = with the current IP. How can I specify "any string" in the value?
$ kubectl wait --for=jsonpath='{.status.loadBalancer.ingress[0].ip}'=127.0.0.1 service/my-service
service/my-service condition met
I've also tried other jsonPath's (which work in kubectl get
) like {range .status.loadBalancer.ingress[*]}{"Ready"}{end}
in an attempt to convert the IP to a string I can use for the equality check, but I get an unexpected path string
when using it with kubectl wait
Or is there a better way to wait for this service to be ready to get the IP? I'm deploying to GKE from Github Actions