»Nomad Autoscaler Agent

The Nomad Autoscaler agent has a variety of parameters that can be specified via configuration files or command-line flags. Configuration files are written in HCL. The Nomad Autoscaler can read and combine parameters from multiple configuration files or directories to configure the agent.

»Nomad Namespaces

The Nomad Autoscaler currently has limited support for Nomad Namespaces. The nomad configuration below supports specifying a namespace; if configured with a namespace, the Autoscaler will retrieve scaling policies and perform autoscaling only for jobs in that namespace. A future version will include support for multiple namespaces.

»Nomad ACLs

The Nomad Autoscaler can be configured to interact with an ACL-enabled Nomad cluster. Nomad 0.11 includes the scale ACL policy disposition specifically for supporting the operations of the Nomad Autoscaler. Therefore, the following policy is sufficient for creating an ACL token that can be used by the autoscaler for fetching scaling policies and scaling jobs:

namespace "default" {
  policy = "scale"
namespace "default" {  policy = "scale"}

Other APM and target plugins may require additional ACLs; see the plugin documentation for more information.

»Load Order and Merging

The Nomad Autoscaler agent supports multiple configuration files, which can be provided using the -config CLI flag. The flag can accept either a file or folder. In the case of a folder, any .hcl and .json files in the folder will be loaded and merged in lexicographical order. Directories are not loaded recursively.

For example:

$ nomad-autoscaler agent -config=autoscaler.conf -config=/etc/nomad-autoscaler -config=extra.json
$ nomad-autoscaler agent -config=autoscaler.conf -config=/etc/nomad-autoscaler -config=extra.json

This will load configuration from autoscaler.conf, from .hcl and .json files under /etc/nomad-autoscaler, and finally from extra.json. As each file is processed, its contents are merged into the existing configuration. When merging, any non-empty values from the latest config file will append or replace parameters in the current configuration. An empty value means "" for strings, 0 for integer or float values, and false for booleans.

»SIGHUP Reload

The Nomad Autoscaler agent supports handling the SIGHUP signal for reloading without the need for restarting the agent. When sending a SIGHUP signal to the agent process, the agent will perform the following actions.

  • reload the contents of the scaling policy directory as defined by the -policy-dir parameter.

  • reconfigure the Nomad clients used to fetch policies and execute scaling actions with the values defined in the nomad block.

  • stop plugins that are no longer present in the configuration file.

  • start plugins that were not previously present in the configuration file.

  • reconfigure the remaining plugins with the configuration defined in their config parameter.

»General Parameters

  • log_level (string: "INFO") - Specify the verbosity level of Nomad Autoscaler's logs. Valid values include DEBUG, INFO, and WARN, in decreasing order of verbosity.

  • log_json (bool: false) - Output logs in a JSON format.

  • plugin_dir (string: "./plugins") - The plugin directory is used to discover Nomad Autoscaler plugins.