[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Obtaining routes from within pods

On Fri, Sep 23, 2016 at 11:19 AM, Gary Franczyk <Gary Franczyk availity com> wrote:
From the point of your application, is there a way to tell what the route name(s) are that point to the pod that your application is in?

Generally, no - after all, you can create multiple routes that point to the same service/set of pods.

Some ideas:

- You can potentially examine the Host header on first-touch to see what clients are using to connect (wait for a request, create certificates etc on first access - this is similar to what web servers like Caddy do for their Let's Encrypt certificate)
- Use the Kubernetes API to determine which service your pod belongs to, then which routes point to that service. But this likely relies on assumptions about the way your application is set up, since these relationships are many-to-one (a service points to a pod, but many services could point to the same pod; same applies for routes)
- Use an environment variable to tell pods their external hostname (but this means you need to set this and the route name and keep them in sync)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]