<p>I have got an authentication service. This service is behind an ingress (GKE in my case) for external API calls. When the signup function of the authentication service is called, it will send an email for email verification purpose. The link in this email has to point to the IP of ingress. In order to achieve that, my authentication service has to know the IP of the ingress. How can this be configured dynamically in k8s without storing the ingress IP[ address in a config file?</p>
<p>Many thanks in advance
Regards</p>

lampalork
<p>Since by default GKE allocates <a href="https://cloud.google.com/compute/docs/ip-addresses#ephemeraladdress" rel="nofollow noreferrer">ephemeral external IP address</a> the simplest solution is to reserve <a href="https://cloud.google.com/compute/docs/ip-addresses#reservedaddress" rel="nofollow noreferrer">static ip address</a>. This can be done with new one or you can promote existing ephemeral IP to static one. With this solution the IP address is known in advance but the drawback of that the IP would have to be hardcoded into the application.</p>
<p>To avoid hardcoding this you could use nslookup to find ip address for this specific host. With this you should update your dns records with an address type record to point to you reserved static IP address.  Please refer to your DNS service`s documentation on setting DNS A records to <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip#configuring_your_domain_name_records" rel="nofollow noreferrer">configure your domain name</a>.</p>
<p>For more reading check <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer#optional_configuring_a_static_ip_address" rel="nofollow noreferrer">how to configure static ip address</a>.</p>
<hr />
<p>The alternative way would be also to  <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#directly-accessing-the-rest-api" rel="nofollow noreferrer">access the Kubernetes REST API directly</a> and fetch the IP address from there.  This depending on your architecture and application design will required appropriate authentication towards API.</p>
