munnerz/kube-plex

expose ADVERTISE_IP

Opened this issue · 5 comments

In order for smart devices, like TVs with the Plex app, to hit the plex server, it needs to have the ADVERTISE_IP set to the IP of the l4 load balancer. I did this locally setting the ENV var and exposing it as an option in values yaml - would be cool if it could figure out what the L4 LB IP was and set it manually rather than me doing it after deployment.

You can also just set it manually in settings > network (advanced) > Custom server access URLs that way if you manually change that setting through the UI it isn't overwritten if the main deployment pod restarts from the env var

@justinrush Is the ADVERTISE_IP supposed to be the IP address that is getting set as the "Private IP" in the GUI? In my case, it does not work. I have it set in the deployment file, and I can see it when doing a describe of the pod, and can see it as an environment variable into the pod. The the "Private IP" still is the pod IP instead of the one set in the ADVERTISE_IP env. variable.

@tardich ADVERTISE_IP is the IP that the service will tell clients to connect to. The pod IP will always be the internal k8s cluster ip.

@justinrush OK so, apparently, something's not working well with my setup then. I have the POD IP of, right now, 10.42.2.60. My service IP is 10.43.90.23, and the exposedIP (the IP given by the loadBalancer) is 192.168.212.3, which is advertised to the router with the BGP protocol (can see it in the routing table). The GUI is accessed through my ingress controller.

So let's say I want to access the plex data from the GUI. I configured the ADVERTISE_IP as 192.168.212.3. But it doesn't seem to do anything. If I want to access the data, I've figured out that it's still trying to reach the plex server, on port 32400, to the 10.42.2.60 (which is the POD IP). It doesn't make any sense, as this is an internal IP. So what I managed to do is by setting a redirection rule, on the router/firewall to redirect traffic directed to 10.42.2.60 to 192.168.212.3 and then voilà! it appears.

The thing is that, if the pod restarts on another node, it's IP will change, and my server will be unreachable again until I change the rule to the new IP. I can also create a rule allowing ANY traffic (no matter what destination IP is requested to the service public IP. That would work..... until I want to reach another server with the same port... :-/

@tardich Don't mind me showing up a year late to answer your question.

You mentioned that you have an ingress. You should use that as your ADVERTISE_IP. In the GUI, the ADVERTISE_IP goes into the "Customer server access URLS", which works with a comma separated list of urls. For example, mine is http://plex.10.0.0.18.nip.io/ which is the host my ingress is looking for.

This field lets you set multiple urls, so you could actually set the ingress address, the loadbalaner address, and any other alternative schemes you'd like.