github.com/diptanu/nomad@v0.5.7-0.20170516172507-d72e86cbe3d9/website/source/docs/agent/configuration/client.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "client Stanza - Agent Configuration"
     4  sidebar_current: "docs-agent-configuration-client"
     5  description: |-
     6    The "client" stanza configures the Nomad agent to accept jobs as assigned by
     7    the Nomad server, join the cluster, and specify driver-specific configuration.
     8  ---
     9  
    10  # `client` Stanza
    11  
    12  <table class="table table-bordered table-striped">
    13    <tr>
    14      <th width="120">Placement</th>
    15      <td>
    16        <code>**client**</code>
    17      </td>
    18    </tr>
    19  </table>
    20  
    21  The `client` stanza configures the Nomad agent to accept jobs as assigned by
    22  the Nomad server, join the cluster, and specify driver-specific configuration.
    23  
    24  ```hcl
    25  client {
    26    enabled = true
    27    servers = ["1.2.3.4:4647", "5.6.7.8:4647"]
    28  }
    29  ```
    30  
    31  ## `client` Parameters
    32  
    33  - `alloc_dir` `(string: "[data_dir]/alloc")` - Specifies the directory to use
    34    for allocation data. By default, this is the top-level
    35    [data_dir](/docs/agent/configuration/index.html#data_dir) suffixed with
    36    "alloc", like `"/opt/nomad/alloc"`. This must be an absolute path
    37  
    38  - `chroot_env` <code>([ChrootEnv](#chroot_env-parameters): nil)</code> -
    39    Specifies a key-value mapping that defines the chroot environment for jobs
    40    using the Exec and Java drivers.
    41  
    42  - `enabled` `(bool: false)` - Specifies if client mode is enabled. All other
    43    client configuration options depend on this value.
    44  
    45  - `max_kill_timeout` `(string: "30s")` - Specifies the maximum amount of time a
    46    job is allowed to wait to exit. Individual jobs may customize their own kill
    47    timeout, but it may not exceed this value.
    48  
    49  - `meta` `(map[string]string: nil)` - Specifies a key-value map that annotates
    50    with user-defined metadata.
    51  
    52  - `network_interface` `(string: "lo | lo0")` - Specifies the name of the
    53    interface to force network fingerprinting on. This defaults to the loopback
    54    interface. All addresses on the interface are fingerprinted except the ones
    55    which are scoped local for IPv6. When allocating ports for tasks, the
    56    scheduler will choose from the IPs of the fingerprinted interface.
    57  
    58  - `network_speed` `(int: 0)` - Specifies an override for the network link speed.
    59    This value, if set, overrides any detected or defaulted link speed. Most
    60    clients can determine their speed automatically, and thus in most cases this
    61    should be left unset.
    62  
    63  - `cpu_total_compute` `(int: 0)` - Specifies an override for the total cpu
    64    compute. This value should be set to `# Cores * Core MHz`. For example, a
    65    quadcore running at 2GHz would have a total compute of 8000 (4 * 2000). Most
    66    clients can determine their total cpu compute automatically, and thus in most
    67    cases this should be left unset.
    68  
    69  - `node_class` `(string: "")` - Specifies an arbitrary string used to logically
    70    group client nodes by user-defined class. This can be used during job
    71    placement as a filter.
    72  
    73  - `options` <code>([Options](#options-parameters): nil)</code> - Specifies a
    74    key-value mapping of internal configuration for clients, such as for driver
    75    configuration.
    76  
    77  - `reserved` <code>([Reserved](#reserved-parameters): nil)</code> - Specifies
    78    that Nomad should reserve a portion of the node's resources from receiving
    79    tasks. This can be used to target a certain capacity usage for the node. For
    80    example, 20% of the node's CPU could be reserved to target a CPU utilization
    81    of 80%.
    82  
    83  - `servers` `(array<string>: [])` - Specifies an array of addresses to the Nomad
    84    servers this client should join. This list is used to register the client with
    85    the server nodes and advertise the available resources so that the agent can
    86    receive work. This may be specified as an IP address or DNS, with or without
    87    the port. If the port is omitted, the default port of `4647` is used.
    88  
    89  - `state_dir` `(string: "[data_dir]/client")` - Specifies the directory to use
    90   to store client state. By default, this is - the top-level
    91   [data_dir](/docs/agent/configuration/index.html#data_dir) suffixed with
    92   "client", like `"/opt/nomad/client"`. This must be an absolute path.
    93  
    94  - `gc_interval` `(string: "1m")` - Specifies the interval at which Nomad
    95    attempts to garbage collect terminal allocation directories. 
    96  
    97  - `gc_disk_usage_threshold` `(float: 80)` - Specifies the disk usage percent which
    98    Nomad tries to maintain by garbage collecting terminal allocations.
    99  
   100  - `gc_inode_usage_threshold` `(float: 70)` - Specifies the inode usage percent
   101    which Nomad tries to maintain by garbage collecting terminal allocations.
   102  
   103  - `gc_parallel_destroys` `(int: 2)` - Specifies the maximum number of
   104    parallel destroys allowed by the garbage collector. This value should be
   105    relatively low to avoid high resource usage during garbage collections.
   106  
   107  - `no_host_uuid` `(bool: false)` - Force the UUID generated by the client to be
   108    randomly generated and not be based on the host's UUID.
   109  
   110  ### `chroot_env` Parameters
   111  
   112  Drivers based on [isolated fork/exec](/docs/drivers/exec.html) implement file
   113  system isolation using chroot on Linux. The `chroot_env` map allows the chroot
   114  environment to be configured using source paths on the host operating system.
   115  The mapping format is:
   116  
   117  ```text
   118  source_path -> dest_path
   119  ```
   120  
   121  The following example specifies a chroot which contains just enough to run the
   122  `ls` utility:
   123  
   124  ```hcl
   125  client {
   126    chroot_env {
   127      "/bin/ls"           = "/bin/ls"
   128      "/etc/ld.so.cache"  = "/etc/ld.so.cache"
   129      "/etc/ld.so.conf"   = "/etc/ld.so.conf"
   130      "/etc/ld.so.conf.d" = "/etc/ld.so.conf.d"
   131      "/lib"              = "/lib"
   132      "/lib64"            = "/lib64"
   133    }
   134  }
   135  ```
   136  
   137  When `chroot_env` is unspecified, the `exec` driver will use a default chroot
   138  environment with the most commonly used parts of the operating system. Please
   139  see the [Nomad `exec` driver documentation](/docs/drivers/exec.html#chroot) for
   140  the full list.
   141  
   142  ### `options` Parameters
   143  
   144  The following is not an exhaustive list of options for only the Nomad
   145  client. To find the options supported by each individual Nomad driver, please
   146  see the [drivers documentation](/docs/drivers/index.html).
   147  
   148  - `"driver.whitelist"` `(string: "")` - Specifies a comma-separated list of
   149    whitelisted drivers . If specified, drivers not in the whitelist will be
   150    disabled. If the whitelist is empty, all drivers are fingerprinted and enabled
   151    where applicable.
   152  
   153      ```hcl
   154      client {
   155        options = {
   156          "driver.whitelist" = "docker,qemu"
   157        }
   158      }
   159      ```
   160  
   161  - `"driver.blacklist"` `(string: "")` - Specifies a comma-separated list of
   162    blacklisted drivers . If specified, drivers in the blacklist will be
   163    disabled.
   164  
   165      ```hcl
   166      client {
   167        options = {
   168          "driver.blacklist" = "docker,qemu"
   169        }
   170      }
   171      ```
   172  
   173  - `"env.blacklist"` `(string: see below)` - Specifies a comma-separated list of
   174    environment variable keys not to pass to these tasks. Nomad passes the host
   175    environment variables to `exec`, `raw_exec` and `java` tasks. If specified,
   176    the defaults are overridden. If a value is provided, **all** defaults are
   177    overridden (they are not merged).
   178  
   179      ```hcl
   180      client {
   181        options = {
   182          "env.blacklist" = "MY_CUSTOM_ENVVAR"
   183        }
   184      }
   185      ```
   186  
   187      The default list is:
   188  
   189      ```text
   190      CONSUL_TOKEN
   191      VAULT_TOKEN
   192      ATLAS_TOKEN
   193      AWS_ACCESS_KEY_ID
   194      AWS_SECRET_ACCESS_KEY
   195      AWS_SESSION_TOKEN
   196      GOOGLE_APPLICATION_CREDENTIALS
   197      ```
   198  
   199  - `"user.blacklist"` `(string: see below)` - Specifies a comma-separated
   200    blacklist of usernames for which a task is not allowed to run. This only
   201    applies if the driver is included in `"user.checked_drivers"`. If a value is
   202    provided, **all** defaults are overridden (they are not merged).
   203  
   204      ```hcl
   205      client {
   206        options = {
   207          "user.blacklist" = "root,ubuntu"
   208        }
   209      }
   210      ```
   211  
   212      The default list is:
   213  
   214      ```text
   215      root
   216      Administrator
   217      ```
   218  
   219  - `"user.checked_drivers"` `(string: see below)` - Specifies a comma-separated
   220    list of drivers for which to enforce the `"user.blacklist"`. For drivers using
   221    containers, this enforcement is usually unnecessary. If a value is provided,
   222    **all** defaults are overridden (they are not merged).
   223  
   224      ```hcl
   225      client {
   226        options = {
   227          "user.checked_drivers" = "exec,raw_exec"
   228        }
   229      }
   230      ```
   231  
   232      The default list is:
   233  
   234      ```text
   235      exec
   236      qemu
   237      java
   238      ```
   239  
   240  - `"fingerprint.whitelist"` `(string: "")` - Specifies a comma-separated list of
   241    whitelisted fingerprinters. If specified, any fingerprinters not in the
   242    whitelist will be disabled. If the whitelist is empty, all fingerprinters are
   243    used.
   244  
   245      ```hcl
   246      client {
   247        options = {
   248          "fingerprint.whitelist" = "network"
   249        }
   250      }
   251      ```
   252  
   253  - `"fingerprint.blacklist"` `(string: "")` - Specifies a comma-separated list of
   254    blacklisted fingerprinters. If specified, any fingerprinters in the blacklist
   255    will be disabled.
   256  
   257      ```hcl
   258      client {
   259        options = {
   260          "fingerprint.blacklist" = "network"
   261        }
   262      }
   263      ```
   264  
   265  ### `reserved` Parameters
   266  
   267  - `cpu` `(int: 0)` - Specifies the amount of CPU to reserve, in MHz.
   268  
   269  - `memory` `(int: 0)` - Specifies the amount of memory to reserve, in MB.
   270  
   271  - `disk` `(int: 0)` - Specifies the amount of disk to reserve, in MB.
   272  
   273  - `reserved_ports` `(string: "")` - Specifies a comma-separated list of ports to
   274    reserve on all fingerprinted network devices. Ranges can be specified by using
   275    a hyphen separated the two inclusive ends.
   276  
   277  ## `client` Examples
   278  
   279  ### Common Setup
   280  
   281  This example shows the most basic configuration for a Nomad client joined to a
   282  cluster.
   283  
   284  ```hcl
   285  client {
   286    enabled = true
   287    servers = ["1.2.3.4:4647", "5.6.7.8:4647"]
   288  }
   289  ```
   290  
   291  ### Reserved Resources
   292  
   293  This example shows a sample configuration for reserving resources to the client.
   294  This is useful if you want to allocate only a portion of the client's resources
   295  to jobs.
   296  
   297  ```hcl
   298  client {
   299    enabled = true
   300  
   301    reserved {
   302      cpu            = 500
   303      memory         = 512
   304      disk           = 1024
   305      reserved_ports = "22,80,8500-8600"
   306    }
   307  }
   308  ```
   309  
   310  ### Custom Metadata, Network Speed, and Node Class
   311  
   312  This example shows a client configuration which customizes the metadata, network
   313  speed, and node class.
   314  
   315  ```hcl
   316  client {
   317    enabled       = true
   318    network_speed = 500
   319    node_class    = "prod"
   320  
   321    meta {
   322      "owner" = "ops"
   323    }
   324  }
   325  ```