I'm running an application in Kubernetes that sits behind a ClusterIP service (which is then accessed from the outside world via an Ingress policy).
The hosted application offers an API, which is accessed from the outside world via the Ingress service - e.g.
example.com/api/my_ip
And responds with the IP address of the Pod the application lives in. This API value is used for other services to access the application on example.com
so an ephemeral, private, Pod IP is of little use.
I know it is possible with an Kubernetes Nginx Ingress to create URL rewrite annotations, but these seem to only rewrite a given URL. Does an annotation (or another solution) exist that will rewrite the JSON response from this API from, e.g.
{"LocalAddress":"http://10.88.160.78:1234"}
to
{"LocalAddress":"http://example.com:1234"}