2020-07-01 11:03:49 +00:00
|
|
|
---
|
|
|
|
layout: docs
|
|
|
|
page_title: Agent
|
|
|
|
description: The Nomad Autoscaler is a long lived process which coordinates scaling activates.
|
|
|
|
---
|
|
|
|
|
|
|
|
# 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][hcl_v2]. 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][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:
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
namespace "default" {
|
2020-07-01 13:41:16 +00:00
|
|
|
policy = "scale"
|
2020-07-01 11:03:49 +00:00
|
|
|
}
|
2020-07-08 22:42:41 +00:00
|
|
|
```
|
2020-07-01 11:03:49 +00:00
|
|
|
|
|
|
|
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
|
2020-07-08 22:42:41 +00:00
|
|
|
provided using the [`-config`][autoscaler_cli_config] CLI flag. The flag can
|
2020-07-01 11:03:49 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
```shell-session
|
2023-04-27 14:00:28 +00:00
|
|
|
$ nomad-autoscaler agent -config=autoscaler.hcl -config=/etc/nomad-autoscaler -config=extra.json
|
2020-07-01 11:03:49 +00:00
|
|
|
```
|
|
|
|
|
2023-04-27 14:00:28 +00:00
|
|
|
This will load configuration from `autoscaler.hcl`, from `.hcl` and `.json` files
|
2020-07-01 11:03:49 +00:00
|
|
|
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.
|
|
|
|
|
2020-07-01 13:41:16 +00:00
|
|
|
## 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.
|
|
|
|
|
2020-07-08 22:42:41 +00:00
|
|
|
- reload the contents of the scaling policy directory as defined by the [`-policy-dir`][autoscaler_cli_policy_dir]
|
2020-07-01 13:41:16 +00:00
|
|
|
parameter.
|
|
|
|
|
2021-02-22 20:38:26 +00:00
|
|
|
- reconfigure the Nomad clients used to fetch policies and execute scaling
|
2021-04-23 13:53:58 +00:00
|
|
|
actions with the values defined in the [`nomad`][autoscaler_agent_nomad]
|
|
|
|
block.
|
2021-02-22 20:38:26 +00:00
|
|
|
|
|
|
|
- stop plugins that are no longer present in the configuration file.
|
|
|
|
|
2021-02-22 21:37:03 +00:00
|
|
|
- start plugins that were not previously present in the configuration file.
|
2021-02-22 20:38:26 +00:00
|
|
|
|
2021-02-22 21:20:58 +00:00
|
|
|
- reconfigure the remaining plugins with the configuration defined in their
|
2021-02-22 20:38:26 +00:00
|
|
|
`config` parameter.
|
|
|
|
|
2020-07-01 11:03:49 +00:00
|
|
|
## General Parameters
|
|
|
|
|
2022-10-19 18:17:41 +00:00
|
|
|
- `enable_debug` `(bool: false)` - Specifies if the debugging HTTP endpoints
|
|
|
|
should be enabled. These endpoints can be used with profiling tools to dump
|
|
|
|
diagnostic information about the Nomad Autoscaler's internals.
|
|
|
|
|
2020-07-01 11:03:49 +00:00
|
|
|
- `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.
|
|
|
|
|
|
|
|
[hcl_v2]: https://github.com/hashicorp/hcl/tree/hcl2
|
2023-01-25 17:31:14 +00:00
|
|
|
[nomad_namespaces]: /nomad/tutorials/manage-clusters/namespaces
|
|
|
|
[nomad_acls]: /nomad/tutorials/access-control
|
|
|
|
[autoscaler_agent_nomad]: /nomad/tools/autoscaling/agent/nomad
|
|
|
|
[autoscaler_cli_config]: /nomad/tools/autoscaling/cli#config
|
|
|
|
[autoscaler_cli_policy_dir]: /nomad/tools/autoscaling/cli#policy-dir
|