Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Fabio to prefer one ethernet interface for proxy_addr? #802

Closed
protocol6 opened this issue Nov 30, 2020 · 2 comments
Closed

Can Fabio to prefer one ethernet interface for proxy_addr? #802

protocol6 opened this issue Nov 30, 2020 · 2 comments

Comments

@protocol6
Copy link

Hi,

I'm running a cluster where the worker nodes run Nomad and Consul.
Each node (on Digitalocean) has a public IP on eth0 and a private IP on eth1.
I schedule fabio onto this cluster via nomad jobspec like so,

  group "fabio" {
      task "fabio" {
      driver = "exec"
      config {
        command = "fabio-1.5.14-go1.15-linux_amd64"
        args = ["-proxy.addr", ":9999", "-ui.addr", ":9998"]
      }

Unfortunately the above stanza results in fabio proxy_addr binding to my public IPs and not the private ones, which results in an⋅
empty/non-working routing table on private:9998/routes.⋅

Based on issue #653 I tried the following argument format, but it causes the allocated job to fail.

args = ["-proxy.addr", "{{ GetInterfaceIP 'eth1' }}:9999", "-ui.addr", "{{ GetInterfaceIP 'eth1' }}:9998"]

Based on issue #283 I tried the following, but these too causes the fabio job to fail and/or to violate jobspec syntax..

args = ["-proxy.addr", "eth1:9999", "-ui.addr", "eth1:9998"]

and

`args = ["-proxy.addr", "${ifconfig eth1 | grep 'inet' | awk '{print $2}' | cut -d: -f2}:9999", "-ui.addr", "${ifconfig eth1 | grep 'inet' | awk '{print

Question: is there a working mechanism in Fabio that lets you prefer one ethernet interface over another (eth1 for me)
and which is compatible with job submission via Nomad jobspec?

@nathanejohnson
Copy link
Member

So several questions:

  1. what does your nomad job spec look like?
  2. are you sure there is an eth1 available?
  3. what is nature of the nomad failure?

The first example you gave should more or less work, assuming eth1 exists and is available when fabio is launched

@protocol6
Copy link
Author

Hi nathanejohnson,

Thanks for responding so quickly and sorry for my radio-silence.

I think I may have solved my issue with the following pattern. It seems to reliably bind fabio to the private IP, but I can't guarantee that it will always work in very circumstance.

group "fabio" {
      task "fabio" {
      driver = "exec"
      config {
        command = "fabio-1.5.15-go1.15.5-linux_amd64"
        args = ["-proxy.addr", "$${attr.unique.network.ip-address}:9999", "-registry.consul.addr", "$${attr.unique.network.ip-address}:8500", "-ui.addr", "$${attr.unique.network.ip-address}:9998"]
      }

      artifact {
        source = "https://github.com/fabiolb/fabio/releases/download/v1.5.15/fabio-1.5.15-go1.15.5-linux_amd64"
      }

The key to making this work for me was the use $$ instead of just $. Apparently this provides a necessary shell escape at least when using the Nomad provider in Terraform.

I would call this issue solved.

Thanks again for your attention.

:-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants