1

I'm trying to create a local environment for testing purpose composed of:

  • a Vagrant CoreOS Cluster (3 nodes)
  • a Docker container launched with an Nginx image loaded, launched on one node

I've successfully installed Vagrant and CoreOS. Etcd is up and running and I've played a lot with Fleet. I've also launched a Nginx container throw Fleet services. What I can't really figure out is:

  • How can I route traffic on a specific container? I want that pointing my local browser to a local address (i.e. example.dev), the cluster answers with the right Nginx container (placed somewhere on the cluster).
  • Is a proxy an appropriate solution? If not - is there something created for this purpose?

Thanks in advance and feel free to ask more details I may have forgotten!

0

The simple answer is just to edit your local hosts file, e.g. /etc/hosts on Linux or OS X, or C:\Windows\System32\drivers\etc\hosts on a typical Windows box.

If you want something that's more production-level than a quick fix for development, then what you need is a reverse proxy like nginx or haproxy, and have it automatically configured by the availability of backend nginx containers.

  • each backend nginx container will need a 'sidekick' service to announce its availability to etcd
  • then run confd to listen for etcd changes and update the configuration of the reverse proxy

This allows you to route a single port on the reverse proxy to any number of backend nginx services which need only listen on the private network.

I've written a more detailed illustration of this approach here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.