My Nomad Cluster

Over the last year I have become a big fan of the Hashicorp stack. They build clean, stable and useful tools for developers. While I use Terraform on a regular basis I wanted to spend some time exploring Nomad and Consul. I have read about these technologies off and on and I was curious about their approach to container management and orchestration. While researching these topics, I came across this blog post and its corresponding github repo. The guys at discoposse did a great job with their lab environment.

I decided to take their lab environment and extend it and put my own twist on it. I liked the outcome of it so much that I ended up using it for a lot of my day-to-day service work. Here is a link to my lab environment in Github. The lab environment:

  1. Installs a 3-node nomad/consul cluster. This came from the original discoposse lab and includes the basics of setting up the nomad cluster and lab. One thing I did differently from the original lab is switched the entire lab away from using shell scripts to do provisioning and moved it over to ansible.

  2. Installs DNSMasq on all three of the clusters. The original discoposse cluster did not have the node configured to use consul as one of their DNS servers. This made it a little bit painful to hop onto a node in the cluster and try to curl to a target endpoint for a service.

  3. Leverages a Krakend service API gateway. Through my professional work and my book I have used the concept of API gateways to provide a central policy enforcement point (PEP) for all service calls. I wanted to try out a different API gateway then the Spring Cloud API gateway so I settled on trying Krakend. Its a pretty good API gateway and I am still learning the ins and outs if it.

  4. Provides a simple service to deploy. The original discoposse lab set up the cluster, but did not include a sample service to actually test to see if everything is working correctly. I wrote a simple GoLang service and included everything to deploy it. The service is nothing more then a healthcheck endpoint but it is an example of how to build and deploy a service. For my own edification, I spent some time playing around with Packer and use Packer to build my docker container.

I really enjoyed building this cluster out. I have used Kubernetes in the past, so it was refreshing to see a robust alternative to Kubernetes. I always welcome feedback so if you see anything wrong or a better way to set up something I always welcomes comments and feedback in the github repository.

Additional Resources

  1. Original Discoposse blog post
  2. Discoposse GitHub lab
  3. My Nomad cluster lab
  4. Nomad
  5. Consul
  6. Packer
  7. DnsMasq
  8. Krakend
  9. Ansible