diff --git a/website/content/docs/job-specification/template.mdx b/website/content/docs/job-specification/template.mdx index 24f3b83bc..305103623 100644 --- a/website/content/docs/job-specification/template.mdx +++ b/website/content/docs/job-specification/template.mdx @@ -312,6 +312,33 @@ EOF } ``` +### Simple Load Balancing with Nomad Services + +~> Simple load balancing with Nomad Services is new in Nomad 1.3.2. + +The `nomadService` function now supports simple load balancing by selecting +instances of a service via [rendezvous hashing][rhash]. +To enable simple load balancing, the `nomadService` function requires 3 arguments. + +- The number of services to select +- The hashing key (should be unique, but consistent per requester) +- The service name + +By using `NOMAD_ALLOC_ID` as the hashing key, the selected instances will remain mostly +stable for the allocation, even as instances of the service are added or removed. + +```hcl +template { + data = <