Get cluster's endpoints or external ip into service.yml or pod.yml


#1

Hi All,

Excuse my bad english, I’m french ;).

I’ve created on a cluster serveral pods and services for a rest API.
In one of these pods, the main rest API tool can return a link to a serve file.
I need this link to be dynamic according to the cluster final ip.
Is there a way fto get this ip from the pod or service.yml?

Thanks,


#2

If you know the name of the Service or Ingress that fronts your app, you can use the Kubernetes API to get the load-balancer IP. Those IPs are generally allocated, so you have to ask the API server, not the YAML.