Simple load balancer in Chef


#1

First chef mailing list post ever!

I’ve got a simple setup. Three total Ubuntu 16.04 nodes – two devoted for webservers and one for a load balancer. I’m trying to set up the load balancer, but I’m not sure how or where to start. I noticed that there is a chef provisioning resource, but the documentation (https://docs.chef.io/resource_load_balancer.html) doesn’t seem to include any examples.

Is this a good place to start? Or should I go down the path of configuring my own load balancer? I’m going for the simplest/easiest option.

Thanks!
-jgro


#2

Hi,
The load balancer resource is part of chef provisioning. It literally manages load balancer (ELB) for example on AWS or similar. This is not what you’re looking for specifically.

For your problem at hand you would need to know

  1. how to balance your web server in general (you need to know this)…
  2. break down the pieces needed to do so (maybe nginx?)
  3. automate the installation and configuration of each piece (nginx and a config for it)

once those are known you can proceed with automating a load balancer that works for your needs

there may be some generic chef / community cookbooks out there that do something basic… but even then you need to know what YOU need specifically…

simplest nginx load balancer config out there:
https://www.nginx.com/resources/wiki/start/topics/examples/loadbalanceexample/

keep in mind its just an example - you need to add your business needs and logic to it


#3

Thanks for the reply :slight_smile: I’ll look into it. Round-robin is good enough for me. Sounds like there isn’t any pre-existing recipe on chef to solve my little simple scenario. I’ll try to whip something up using calls to nginx (like you said) or something like it.


#4

Well load balancer uses cases are usually handled with HA-Proxy. And as everyone has different expectetation from a reverse proxy/load-balancer, there’s few chance someone use case would fit someone else one, hence why there’s no existing shared recipes, it would only be useful to a few people.


#5

First, be a bit more specific. Ultimately, you aren’t configuring “a load balancer”. You are configuring Ubuntu and some packages, and the end result will hopefully be a system that does load balancing.

What mechanisms and packages are you using as a load balancer? nginx? Or are you using DNS for round-robin load balancing?

Look for cookbooks that help you configure the selected package.

Basically, chef doesn’t relieve you from the hard decisions: designing how to accomplish your goal. Arguably, you actually have to do more detailed planning than if you tweak configuration files manually. Chef just helps you deal with the grunt work of fiddling with configuration files, and ensuring that the configuration doesn’t get messed up.

Kevin Keane
Whom the IT Pros Call
The NetTech
http://www.4nettech.com
Our values: Privacy, Liberty, Justice
See https://www.4nettech.com/corp/the-nettech-values.html