github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/tools/autoscaling/agent.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: Agent
     4  description: The Nomad Autoscaler is a long lived process which coordinates scaling activates.
     5  ---
     6  
     7  # Nomad Autoscaler Agent
     8  
     9  The Nomad Autoscaler agent has a variety of parameters that can be specified
    10  via configuration files or command-line flags. Configuration files are written
    11  in [HCL][hcl_v2]. The Nomad Autoscaler can read and combine parameters from
    12  multiple configuration files or directories to configure the agent.
    13  
    14  ## Nomad Namespaces
    15  
    16  The Nomad Autoscaler currently has limited support for
    17  [Nomad Namespaces][nomad_namespaces]. The `nomad` configuration below supports
    18  specifying a namespace; if configured with a namespace, the Autoscaler will
    19  retrieve scaling policies and perform autoscaling only for jobs in that
    20  namespace. A future version will include support for multiple namespaces.
    21  
    22  ## Nomad ACLs
    23  
    24  The Nomad Autoscaler can be configured to interact with an ACL-enabled Nomad
    25  cluster. Nomad 0.11 includes the `scale` ACL policy disposition specifically for
    26  supporting the operations of the Nomad Autoscaler. Therefore, the
    27  following policy is sufficient for creating an ACL token that can be used by
    28  the autoscaler for fetching scaling policies and scaling jobs:
    29  
    30  ```hcl
    31  namespace "default" {
    32    policy = "scale"
    33  }
    34  ```
    35  
    36  Other APM and target plugins may require additional ACLs; see the plugin documentation for more information.
    37  
    38  ## Load Order and Merging
    39  
    40  The Nomad Autoscaler agent supports multiple configuration files, which can be
    41  provided using the [`-config`][autoscaler_cli_config] CLI flag. The flag can
    42  accept either a file or folder. In the case of a folder, any `.hcl` and `.json`
    43  files in the folder will be loaded and merged in lexicographical order. Directories
    44  are not loaded recursively.
    45  
    46  For example:
    47  
    48  ```shell-session
    49  $ nomad-autoscaler agent -config=autoscaler.conf -config=/etc/nomad-autoscaler -config=extra.json
    50  ```
    51  
    52  This will load configuration from `autoscaler.conf`, from `.hcl` and `.json` files
    53  under `/etc/nomad-autoscaler`, and finally from `extra.json`. As each file is
    54  processed, its contents are merged into the existing configuration. When merging,
    55  any non-empty values from the latest config file will append or replace
    56  parameters in the current configuration. An empty value means `""` for strings,
    57  `0` for integer or float values, and `false` for booleans.
    58  
    59  ## SIGHUP Reload
    60  
    61  The Nomad Autoscaler agent supports handling the `SIGHUP` signal for reloading without the need for
    62  restarting the agent. When sending a `SIGHUP` signal to the agent process, the agent will perform the
    63  following actions.
    64  
    65  - reload the contents of the scaling policy directory as defined by the [`-policy-dir`][autoscaler_cli_policy_dir]
    66    parameter.
    67  
    68  - reconfigure the Nomad clients used to fetch policies and execute scaling
    69    actions with the values defined in the [`nomad`][autoscaler_agent_nomad]
    70    block.
    71  
    72  - stop plugins that are no longer present in the configuration file.
    73  
    74  - start plugins that were not previously present in the configuration file.
    75  
    76  - reconfigure the remaining plugins with the configuration defined in their
    77    `config` parameter.
    78  
    79  ## General Parameters
    80  
    81  - `enable_debug` `(bool: false)` - Specifies if the debugging HTTP endpoints
    82    should be enabled. These endpoints can be used with profiling tools to dump
    83    diagnostic information about the Nomad Autoscaler's internals.
    84  
    85  - `log_level` `(string: "INFO")` - Specify the verbosity level of Nomad
    86    Autoscaler's logs. Valid values include DEBUG, INFO, and WARN, in decreasing
    87    order of verbosity.
    88  
    89  - `log_json` `(bool: false)` - Output logs in a JSON format.
    90  
    91  - `plugin_dir` `(string: "./plugins")` - The plugin directory is used to
    92    discover Nomad Autoscaler plugins.
    93  
    94  [hcl_v2]: https://github.com/hashicorp/hcl/tree/hcl2
    95  [nomad_namespaces]: https://learn.hashicorp.com/tutorials/nomad/namespaces
    96  [nomad_acls]: https://learn.hashicorp.com/collections/nomad/access-control
    97  [autoscaler_agent_nomad]: /tools/autoscaling/agent/nomad
    98  [autoscaler_cli_config]: /tools/autoscaling/cli#config
    99  [autoscaler_cli_policy_dir]: /tools/autoscaling/cli#policy-dir