2016-11-01 12:53:13 +00:00
|
|
|
---
|
2020-02-06 23:45:31 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: client Stanza - Agent Configuration
|
2016-11-01 12:53:13 +00:00
|
|
|
description: |-
|
|
|
|
The "client" stanza configures the Nomad agent to accept jobs as assigned by
|
|
|
|
the Nomad server, join the cluster, and specify driver-specific configuration.
|
|
|
|
---
|
|
|
|
|
|
|
|
# `client` Stanza
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
<Placement groups={['client']} />
|
2016-11-01 12:53:13 +00:00
|
|
|
|
|
|
|
The `client` stanza configures the Nomad agent to accept jobs as assigned by
|
|
|
|
the Nomad server, join the cluster, and specify driver-specific configuration.
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
enabled = true
|
|
|
|
servers = ["1.2.3.4:4647", "5.6.7.8:4647"]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## `client` Parameters
|
|
|
|
|
|
|
|
- `alloc_dir` `(string: "[data_dir]/alloc")` - Specifies the directory to use
|
2016-11-02 23:26:10 +00:00
|
|
|
for allocation data. By default, this is the top-level
|
2020-02-06 23:45:31 +00:00
|
|
|
[data_dir](/docs/configuration#data_dir) suffixed with
|
2018-08-30 21:20:32 +00:00
|
|
|
"alloc", like `"/opt/nomad/alloc"`. This must be an absolute path.
|
2016-11-01 12:53:13 +00:00
|
|
|
|
2016-11-02 23:26:10 +00:00
|
|
|
- `chroot_env` <code>([ChrootEnv](#chroot_env-parameters): nil)</code> -
|
|
|
|
Specifies a key-value mapping that defines the chroot environment for jobs
|
|
|
|
using the Exec and Java drivers.
|
2016-11-01 12:53:13 +00:00
|
|
|
|
|
|
|
- `enabled` `(bool: false)` - Specifies if client mode is enabled. All other
|
|
|
|
client configuration options depend on this value.
|
|
|
|
|
|
|
|
- `max_kill_timeout` `(string: "30s")` - Specifies the maximum amount of time a
|
|
|
|
job is allowed to wait to exit. Individual jobs may customize their own kill
|
|
|
|
timeout, but it may not exceed this value.
|
|
|
|
|
2019-06-03 19:31:39 +00:00
|
|
|
- `disable_remote_exec` `(bool: false)` - Specifies if the client should disable
|
|
|
|
remote task execution to tasks running on this client.
|
|
|
|
|
2016-12-08 18:35:40 +00:00
|
|
|
- `meta` `(map[string]string: nil)` - Specifies a key-value map that annotates
|
2016-11-01 12:53:13 +00:00
|
|
|
with user-defined metadata.
|
|
|
|
|
2017-11-15 19:32:32 +00:00
|
|
|
- `network_interface` `(string: varied)` - Specifies the name of the interface
|
2017-11-15 20:49:22 +00:00
|
|
|
to force network fingerprinting on. When run in dev mode, this defaults to the
|
|
|
|
loopback interface. When not in dev mode, the interface attached to the
|
2019-11-12 22:32:21 +00:00
|
|
|
default route is used. The scheduler chooses from these fingerprinted IP
|
2021-04-20 17:55:10 +00:00
|
|
|
addresses when allocating ports for tasks. This value support [go-sockaddr/template
|
|
|
|
format][go-sockaddr/template].
|
2016-11-01 12:53:13 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
If no non-local IP addresses are found, Nomad could fingerprint link-local IPv6
|
|
|
|
addresses depending on the client's
|
2020-03-26 20:21:24 +00:00
|
|
|
[`"fingerprint.network.disallow_link_local"`](#fingerprint-network-disallow_link_local)
|
2020-02-06 23:45:31 +00:00
|
|
|
configuration value.
|
2019-08-16 16:44:57 +00:00
|
|
|
|
2017-07-17 18:41:50 +00:00
|
|
|
- `cpu_total_compute` `(int: 0)` - Specifies an override for the total CPU
|
2017-03-14 21:15:49 +00:00
|
|
|
compute. This value should be set to `# Cores * Core MHz`. For example, a
|
2020-02-06 23:45:31 +00:00
|
|
|
quad-core running at 2 GHz would have a total compute of 8000 (4 \* 2000). Most
|
2017-07-17 18:41:50 +00:00
|
|
|
clients can determine their total CPU compute automatically, and thus in most
|
2017-03-14 21:15:49 +00:00
|
|
|
cases this should be left unset.
|
|
|
|
|
2018-03-28 15:15:33 +00:00
|
|
|
- `memory_total_mb` `(int:0)` - Specifies an override for the total memory. If set,
|
|
|
|
this value overrides any detected memory.
|
|
|
|
|
2021-10-01 00:10:28 +00:00
|
|
|
- `min_dynamic_port` `(int:20000)` - Specifies the minimum dynamic port to be
|
|
|
|
assigned. Individual ports and ranges of ports may be excluded from dynamic
|
|
|
|
port assignment via [`reserved`](#reserved-parameters) parameters.
|
|
|
|
|
|
|
|
- `max_dynamic_port` `(int:32000)` - Specifies the maximum dynamic port to be
|
|
|
|
assigned. Individual ports and ranges of ports may be excluded from dynamic
|
|
|
|
port assignment via [`reserved`](#reserved-parameters) parameters.
|
|
|
|
|
2016-11-01 12:53:13 +00:00
|
|
|
- `node_class` `(string: "")` - Specifies an arbitrary string used to logically
|
|
|
|
group client nodes by user-defined class. This can be used during job
|
|
|
|
placement as a filter.
|
|
|
|
|
|
|
|
- `options` <code>([Options](#options-parameters): nil)</code> - Specifies a
|
|
|
|
key-value mapping of internal configuration for clients, such as for driver
|
|
|
|
configuration.
|
|
|
|
|
|
|
|
- `reserved` <code>([Reserved](#reserved-parameters): nil)</code> - Specifies
|
|
|
|
that Nomad should reserve a portion of the node's resources from receiving
|
|
|
|
tasks. This can be used to target a certain capacity usage for the node. For
|
2021-09-22 22:30:39 +00:00
|
|
|
example, a value equal to 20% of the node's CPU could be reserved to target
|
|
|
|
a CPU utilization of 80%.
|
2016-11-01 12:53:13 +00:00
|
|
|
|
|
|
|
- `servers` `(array<string>: [])` - Specifies an array of addresses to the Nomad
|
|
|
|
servers this client should join. This list is used to register the client with
|
|
|
|
the server nodes and advertise the available resources so that the agent can
|
|
|
|
receive work. This may be specified as an IP address or DNS, with or without
|
|
|
|
the port. If the port is omitted, the default port of `4647` is used.
|
|
|
|
|
2018-05-31 17:49:19 +00:00
|
|
|
- `server_join` <code>([server_join][server-join]: nil)</code> - Specifies
|
2018-05-25 22:43:33 +00:00
|
|
|
how the Nomad client will connect to Nomad servers. The `start_join` field
|
|
|
|
is not supported on the client. The retry_join fields may directly specify
|
|
|
|
the server address or use go-discover syntax for auto-discovery. See the
|
|
|
|
documentation for more detail.
|
2018-05-21 17:17:35 +00:00
|
|
|
|
2016-11-01 12:53:13 +00:00
|
|
|
- `state_dir` `(string: "[data_dir]/client")` - Specifies the directory to use
|
2020-02-06 23:45:31 +00:00
|
|
|
to store client state. By default, this is - the top-level
|
|
|
|
[data_dir](/docs/configuration#data_dir) suffixed with
|
|
|
|
"client", like `"/opt/nomad/client"`. This must be an absolute path.
|
2016-11-01 12:53:13 +00:00
|
|
|
|
2017-02-01 00:30:50 +00:00
|
|
|
- `gc_interval` `(string: "1m")` - Specifies the interval at which Nomad
|
2017-08-23 22:32:22 +00:00
|
|
|
attempts to garbage collect terminal allocation directories.
|
2017-02-01 00:30:50 +00:00
|
|
|
|
|
|
|
- `gc_disk_usage_threshold` `(float: 80)` - Specifies the disk usage percent which
|
|
|
|
Nomad tries to maintain by garbage collecting terminal allocations.
|
|
|
|
|
|
|
|
- `gc_inode_usage_threshold` `(float: 70)` - Specifies the inode usage percent
|
|
|
|
which Nomad tries to maintain by garbage collecting terminal allocations.
|
|
|
|
|
2017-05-30 18:39:12 +00:00
|
|
|
- `gc_max_allocs` `(int: 50)` - Specifies the maximum number of allocations
|
2017-05-11 00:39:45 +00:00
|
|
|
which a client will track before triggering a garbage collection of terminal
|
2020-02-06 23:45:31 +00:00
|
|
|
allocations. This will _not_ limit the number of allocations a node can run at
|
2017-05-11 00:39:45 +00:00
|
|
|
a time, however after `gc_max_allocs` every new allocation will cause terminal
|
|
|
|
allocations to be GC'd.
|
|
|
|
|
2017-03-11 00:27:00 +00:00
|
|
|
- `gc_parallel_destroys` `(int: 2)` - Specifies the maximum number of
|
|
|
|
parallel destroys allowed by the garbage collector. This value should be
|
|
|
|
relatively low to avoid high resource usage during garbage collections.
|
|
|
|
|
2017-06-23 23:23:01 +00:00
|
|
|
- `no_host_uuid` `(bool: true)` - By default a random node UUID will be
|
|
|
|
generated, but setting this to `false` will use the system's UUID. Before
|
|
|
|
Nomad 0.6 the default was to use the system UUID.
|
2019-06-14 05:27:16 +00:00
|
|
|
|
|
|
|
- `cni_path` `(string: "/opt/cni/bin")` - Sets the search path that is used for
|
|
|
|
CNI plugin discovery. Multiple paths can be searched using colon delimited
|
|
|
|
paths
|
|
|
|
|
2020-07-08 19:45:04 +00:00
|
|
|
- `cni_config_dir` `(string: "/opt/cni/config")` - Sets the directory where CNI
|
2020-12-07 15:36:39 +00:00
|
|
|
network configuration is located. The client will use this path when fingerprinting
|
|
|
|
CNI networks. Filenames should use the `.conflist` extension.
|
2020-10-01 18:08:49 +00:00
|
|
|
|
2021-07-27 03:24:34 +00:00
|
|
|
- `bridge_network_name` `(string: "nomad")` - Sets the name of the bridge to be
|
2019-06-14 05:27:16 +00:00
|
|
|
created by nomad for allocations running with bridge networking mode on the
|
|
|
|
client.
|
|
|
|
|
2020-11-12 15:09:34 +00:00
|
|
|
- `bridge_network_subnet` `(string: "172.26.64.0/20")` - Specifies the subnet
|
2019-06-14 05:27:16 +00:00
|
|
|
which the client will use to allocate IP addresses from.
|
2017-02-27 21:42:37 +00:00
|
|
|
|
2022-05-03 22:38:32 +00:00
|
|
|
- `artifact` <code>([Artifact](#artifact-parameters): varied)</code> -
|
|
|
|
Specifies controls on the behavior of task
|
|
|
|
[`artifact`](/docs/job-specification/artifact) stanzas.
|
|
|
|
|
2019-08-02 19:20:14 +00:00
|
|
|
- `template` <code>([Template](#template-parameters): nil)</code> - Specifies
|
2019-11-12 22:32:21 +00:00
|
|
|
controls on the behavior of task
|
2020-02-06 23:45:31 +00:00
|
|
|
[`template`](/docs/job-specification/template) stanzas.
|
2019-08-02 19:20:14 +00:00
|
|
|
|
2019-08-26 12:03:28 +00:00
|
|
|
- `host_volume` <code>([host_volume](#host_volume-stanza): nil)</code> - Exposes
|
|
|
|
paths from the host as volumes that can be mounted into jobs.
|
|
|
|
|
2020-07-08 19:45:04 +00:00
|
|
|
- `host_network` <code>([host_network](#host_network-stanza): nil)</code> - Registers
|
|
|
|
additional host networks with the node that can be selected when port mapping.
|
|
|
|
|
2021-05-04 17:58:23 +00:00
|
|
|
- `cgroup_parent` `(string: "/nomad")` - Specifies the cgroup parent for which cgroup
|
|
|
|
subsystems managed by Nomad will be mounted under. Currently this only applies to the
|
|
|
|
`cpuset` subsystems. This field is ignored on non Linux platforms.
|
|
|
|
|
2016-11-01 12:53:13 +00:00
|
|
|
### `chroot_env` Parameters
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
Drivers based on [isolated fork/exec](/docs/drivers/exec) implement file
|
2016-11-01 12:53:13 +00:00
|
|
|
system isolation using chroot on Linux. The `chroot_env` map allows the chroot
|
|
|
|
environment to be configured using source paths on the host operating system.
|
|
|
|
The mapping format is:
|
|
|
|
|
|
|
|
```text
|
|
|
|
source_path -> dest_path
|
|
|
|
```
|
|
|
|
|
|
|
|
The following example specifies a chroot which contains just enough to run the
|
|
|
|
`ls` utility:
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
chroot_env {
|
|
|
|
"/bin/ls" = "/bin/ls"
|
|
|
|
"/etc/ld.so.cache" = "/etc/ld.so.cache"
|
|
|
|
"/etc/ld.so.conf" = "/etc/ld.so.conf"
|
|
|
|
"/etc/ld.so.conf.d" = "/etc/ld.so.conf.d"
|
2019-11-25 18:47:18 +00:00
|
|
|
"/etc/passwd" = "/etc/passwd"
|
2016-11-01 12:53:13 +00:00
|
|
|
"/lib" = "/lib"
|
|
|
|
"/lib64" = "/lib64"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
When `chroot_env` is unspecified, the `exec` driver will use a default chroot
|
|
|
|
environment with the most commonly used parts of the operating system. Please
|
2020-02-06 23:45:31 +00:00
|
|
|
see the [Nomad `exec` driver documentation](/docs/drivers/exec#chroot) for
|
2016-11-01 12:53:13 +00:00
|
|
|
the full list.
|
|
|
|
|
2021-10-15 23:56:14 +00:00
|
|
|
As of Nomad 1.2, Nomad will never attempt to embed the `alloc_dir` in the
|
|
|
|
chroot as doing so would cause infinite recursion.
|
|
|
|
|
2016-11-01 12:53:13 +00:00
|
|
|
### `reserved` Parameters
|
|
|
|
|
|
|
|
- `cpu` `(int: 0)` - Specifies the amount of CPU to reserve, in MHz.
|
|
|
|
|
2022-01-26 14:56:16 +00:00
|
|
|
- `cores` `(int: 0)` - Specifies the number of CPU cores to reserve.
|
|
|
|
|
2016-11-01 12:53:13 +00:00
|
|
|
- `memory` `(int: 0)` - Specifies the amount of memory to reserve, in MB.
|
|
|
|
|
|
|
|
- `disk` `(int: 0)` - Specifies the amount of disk to reserve, in MB.
|
|
|
|
|
|
|
|
- `reserved_ports` `(string: "")` - Specifies a comma-separated list of ports to
|
|
|
|
reserve on all fingerprinted network devices. Ranges can be specified by using
|
|
|
|
a hyphen separated the two inclusive ends.
|
|
|
|
|
2022-05-03 22:38:32 +00:00
|
|
|
### `artifact` Parameters
|
|
|
|
|
|
|
|
- `http_read_timeout` `(string: "30m")` - Specifies the maximum duration in
|
|
|
|
which an HTTP download request must complete before it is canceled. Set to
|
|
|
|
`0` to not enforce a limit.
|
|
|
|
|
|
|
|
- `http_max_size` `(string: "100GB")` - Specifies the maximum size allowed for
|
|
|
|
artifacts downloaded via HTTP. Set to `0` to not enforce a limit.
|
|
|
|
|
|
|
|
- `gcs_timeout` `(string: "30m")` - Specifies the maximum duration in which a
|
|
|
|
Google Cloud Storate operation must complete before it is canceled. Set to
|
|
|
|
`0` to not enforce a limit.
|
|
|
|
|
|
|
|
- `git_timeout` `(string: "30m")` - Specifies the maximum duration in which a
|
|
|
|
Git operation must complete before it is canceled. Set to `0` to not enforce
|
|
|
|
a limit.
|
|
|
|
|
|
|
|
- `hg_timeout` `(string: "30m")` - Specifies the maximum duration in which a
|
|
|
|
Mercurial operation must complete before it is canceled. Set to `0` to not
|
|
|
|
enforce a limit.
|
|
|
|
|
|
|
|
- `s3_timeout` `(string: "30m")` - Specifies the maximum duration in which an
|
|
|
|
S3 operation must complete before it is canceled. Set to `0` to not enforce a
|
|
|
|
limit.
|
|
|
|
|
2019-08-02 19:20:14 +00:00
|
|
|
### `template` Parameters
|
|
|
|
|
2022-03-16 23:33:20 +00:00
|
|
|
- `function_denylist` `([]string: ["plugin", "writeToFile"])` - Specifies a
|
|
|
|
list of template rendering functions that should be disallowed in job specs.
|
2022-03-29 16:25:23 +00:00
|
|
|
By default the `plugin` and `writeToFile` functions are disallowed as they
|
2022-03-16 23:33:20 +00:00
|
|
|
allow unrestricted root access to the host.
|
2019-08-02 19:20:14 +00:00
|
|
|
|
|
|
|
- `disable_file_sandbox` `(bool: false)` - Allows templates access to arbitrary
|
2022-01-10 15:19:07 +00:00
|
|
|
files on the client host via the `file` function. By default, templates can
|
2020-10-15 13:53:25 +00:00
|
|
|
access files only within the [task working directory].
|
2019-08-02 19:20:14 +00:00
|
|
|
|
2022-06-08 18:08:25 +00:00
|
|
|
- `max_stale` `(string: "87600h")` - This is the maximum interval to allow "stale"
|
2022-01-10 15:19:07 +00:00
|
|
|
data. By default, only the Consul leader will respond to queries. Requests to
|
|
|
|
a follower will forward to the leader. In large clusters with many requests,
|
|
|
|
this is not as scalable. This option allows any follower to respond to a query,
|
|
|
|
so long as the last-replicated data is within this bound. Higher values result
|
|
|
|
in less cluster load, but are more likely to have outdated data.
|
|
|
|
|
2022-06-08 18:08:25 +00:00
|
|
|
- `wait` `(map: { min = "5s" max = "4m" })` - Defines the minimum and maximum amount
|
|
|
|
of time to wait before attempting to re-render a template. By default, Consul Template
|
|
|
|
will loop continually and re-render. If this value is set, Nomad will configure Consul
|
|
|
|
Template with a backoff timer that will tick on an interval equal to the specified `min`
|
|
|
|
value. Consul Template will always wait at least the as long as the `min` value specified.
|
|
|
|
If the underlying data has not changed between two tick intervals, Consul Template will
|
|
|
|
re-render. If the underlying data has changed, Consul Template will delay re-rendering
|
|
|
|
until the underlying data stabilizes for at least one tick interval, or the configured
|
|
|
|
`max` duration has elapsed. Once the `max` duration has elapsed, Consul Template will
|
|
|
|
re-render the template with the data available at the time. This is useful to enable in
|
|
|
|
systems where Consul is in a degraded state, or the referenced data values are changing
|
|
|
|
rapidly, because it will reduce the number of times a template is rendered. This
|
|
|
|
configuration is also exposed in the _task template stanza_ to allow overrides per task.
|
2022-01-10 15:19:07 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
wait {
|
|
|
|
min = "5s"
|
2022-06-08 18:08:25 +00:00
|
|
|
max = "4m"
|
2022-01-10 15:19:07 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-06-08 18:08:25 +00:00
|
|
|
- `wait_bounds` `(map: nil)` - Defines client level lower and upper bounds for
|
2022-01-10 15:19:07 +00:00
|
|
|
per-template `wait` configuration. If the individual template configuration has
|
|
|
|
a `min` lower than `wait_bounds.min` or a `max` greater than the `wait_bounds.max`,
|
|
|
|
the bounds will be enforced, and the template `wait` will be adjusted before being
|
|
|
|
sent to `consul-template`.
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
wait_bounds {
|
|
|
|
min = "5s"
|
|
|
|
max = "10s"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-06-08 18:08:25 +00:00
|
|
|
- `block_query_wait` `(string: "5m")` - This is amount of time in seconds to wait
|
2022-01-10 15:19:07 +00:00
|
|
|
for the results of a blocking query. Many endpoints in Consul support a feature known as
|
|
|
|
"blocking queries". A blocking query is used to wait for a potential change
|
|
|
|
using long polling.
|
|
|
|
|
2022-06-08 18:08:25 +00:00
|
|
|
- `consul_retry` `(map: { attempts = 0 backoff = "250ms" max_backoff = "1m" })`-
|
|
|
|
This controls the retry behavior when an error is returned from Consul. The template
|
|
|
|
runner will not exit in the face of failure. Instead, it uses exponential back-off
|
|
|
|
and retry functions to wait for the Consul cluster to become available, as is
|
|
|
|
customary in distributed systems.
|
2022-01-10 15:19:07 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
consul_retry {
|
|
|
|
# This specifies the number of attempts to make before giving up. Each
|
|
|
|
# attempt adds the exponential backoff sleep time. Setting this to
|
|
|
|
# zero will implement an unlimited number of retries.
|
2022-06-08 18:08:25 +00:00
|
|
|
attempts = 0
|
2022-01-10 15:19:07 +00:00
|
|
|
# This is the base amount of time to sleep between retry attempts. Each
|
|
|
|
# retry sleeps for an exponent of 2 longer than this base. For 5 retries,
|
|
|
|
# the sleep times would be: 250ms, 500ms, 1s, 2s, then 4s.
|
|
|
|
backoff = "250ms"
|
|
|
|
# This is the maximum amount of time to sleep between retry attempts.
|
|
|
|
# When max_backoff is set to zero, there is no upper limit to the
|
|
|
|
# exponential sleep between retry attempts.
|
|
|
|
# If max_backoff is set to 10s and backoff is set to 1s, sleep times
|
|
|
|
# would be: 1s, 2s, 4s, 8s, 10s, 10s, ...
|
|
|
|
max_backoff = "1m"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-06-08 18:08:25 +00:00
|
|
|
- `vault_retry` `(map: { attempts = 0 backoff = "250ms" max_backoff = "1m" })` -
|
|
|
|
This controls the retry behavior when an error is returned from Vault. Consul
|
|
|
|
Template is highly fault tolerant, meaning it does not exit in the face of failure.
|
|
|
|
Instead, it uses exponential back-off and retry functions to wait for the cluster
|
|
|
|
to become available, as is customary in distributed systems.
|
2022-01-10 15:19:07 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
vault_retry {
|
|
|
|
# This specifies the number of attempts to make before giving up. Each
|
|
|
|
# attempt adds the exponential backoff sleep time. Setting this to
|
|
|
|
# zero will implement an unlimited number of retries.
|
2022-06-08 18:08:25 +00:00
|
|
|
attempts = 0
|
2022-01-10 15:19:07 +00:00
|
|
|
# This is the base amount of time to sleep between retry attempts. Each
|
|
|
|
# retry sleeps for an exponent of 2 longer than this base. For 5 retries,
|
|
|
|
# the sleep times would be: 250ms, 500ms, 1s, 2s, then 4s.
|
|
|
|
backoff = "250ms"
|
|
|
|
# This is the maximum amount of time to sleep between retry attempts.
|
|
|
|
# When max_backoff is set to zero, there is no upper limit to the
|
|
|
|
# exponential sleep between retry attempts.
|
|
|
|
# If max_backoff is set to 10s and backoff is set to 1s, sleep times
|
|
|
|
# would be: 1s, 2s, 4s, 8s, 10s, 10s, ...
|
|
|
|
max_backoff = "1m"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-08-26 12:03:28 +00:00
|
|
|
### `host_volume` Stanza
|
|
|
|
|
|
|
|
The `host_volume` stanza is used to make volumes available to jobs.
|
|
|
|
|
2019-11-12 22:32:21 +00:00
|
|
|
The key of the stanza corresponds to the name of the volume for use in the
|
2020-02-06 23:45:31 +00:00
|
|
|
`source` parameter of a `"host"` type [`volume`](/docs/job-specification/volume)
|
2019-08-26 12:03:28 +00:00
|
|
|
and ACLs.
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
host_volume "ca-certificates" {
|
|
|
|
path = "/etc/ssl/certs"
|
|
|
|
read_only = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `host_volume` Parameters
|
|
|
|
|
|
|
|
- `path` `(string: "", required)` - Specifies the path on the host that should
|
|
|
|
be used as the source when this volume is mounted into a task. The path must
|
|
|
|
exist on client startup.
|
|
|
|
|
|
|
|
- `read_only` `(bool: false)` - Specifies whether the volume should only ever be
|
|
|
|
allowed to be mounted `read_only`, or if it should be writeable.
|
2019-08-02 19:20:14 +00:00
|
|
|
|
2020-07-08 19:45:04 +00:00
|
|
|
### `host_network` Stanza
|
|
|
|
|
|
|
|
The `host_network` stanza is used to register additional host networks with
|
|
|
|
the node that can be used when port mapping.
|
|
|
|
|
|
|
|
The key of the stanza corresponds to the name of the network used in the
|
2020-07-23 13:18:59 +00:00
|
|
|
[`host_network`](/docs/job-specification/network#host-networks).
|
2020-07-08 19:45:04 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
host_network "public" {
|
|
|
|
cidr = "203.0.113.0/24"
|
|
|
|
reserved_ports = "22,80"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `host_network` Parameters
|
|
|
|
|
|
|
|
- `cidr` `(string: "")` - Specifies a cidr block of addresses to match against.
|
2020-09-30 13:48:40 +00:00
|
|
|
If an address is found on the node that is contained by this cidr block, the
|
|
|
|
host network will be registered with it.
|
2020-07-08 19:45:04 +00:00
|
|
|
|
|
|
|
- `interface` `(string: "")` - Filters searching of addresses to a specific interface.
|
|
|
|
|
|
|
|
- `reserved_ports` `(string: "")` - Specifies a comma-separated list of ports to
|
|
|
|
reserve on all fingerprinted network devices. Ranges can be specified by using
|
|
|
|
a hyphen separating the two inclusive ends.
|
|
|
|
|
2016-11-01 12:53:13 +00:00
|
|
|
## `client` Examples
|
|
|
|
|
|
|
|
### Common Setup
|
|
|
|
|
|
|
|
This example shows the most basic configuration for a Nomad client joined to a
|
|
|
|
cluster.
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
enabled = true
|
2018-05-25 20:04:32 +00:00
|
|
|
server_join {
|
|
|
|
retry_join = [ "1.1.1.1", "2.2.2.2" ]
|
|
|
|
retry_max = 3
|
|
|
|
retry_interval = "15s"
|
|
|
|
}
|
2016-11-01 12:53:13 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Reserved Resources
|
|
|
|
|
|
|
|
This example shows a sample configuration for reserving resources to the client.
|
|
|
|
This is useful if you want to allocate only a portion of the client's resources
|
|
|
|
to jobs.
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
enabled = true
|
|
|
|
|
|
|
|
reserved {
|
|
|
|
cpu = 500
|
|
|
|
memory = 512
|
|
|
|
disk = 1024
|
|
|
|
reserved_ports = "22,80,8500-8600"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Custom Metadata, Network Speed, and Node Class
|
|
|
|
|
|
|
|
This example shows a client configuration which customizes the metadata, network
|
2019-11-12 22:32:21 +00:00
|
|
|
speed, and node class. The scheduler can use this information while processing
|
|
|
|
[constraints][metadata_constraint]. The metadata is completely user configurable;
|
|
|
|
the values below are for illustrative purposes only.
|
2016-11-01 12:53:13 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
client {
|
|
|
|
enabled = true
|
|
|
|
node_class = "prod"
|
|
|
|
|
|
|
|
meta {
|
2020-12-10 16:33:13 +00:00
|
|
|
owner = "ops"
|
|
|
|
cached_binaries = "redis,apache,nginx,jq,cypress,nodejs"
|
|
|
|
rack = "rack-12-1"
|
2016-11-01 12:53:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2019-11-12 22:32:21 +00:00
|
|
|
|
2019-01-29 20:53:05 +00:00
|
|
|
[plugin-options]: #plugin-options
|
2020-02-06 23:45:31 +00:00
|
|
|
[plugin-stanza]: /docs/configuration/plugin
|
|
|
|
[server-join]: /docs/configuration/server_join 'Server Join'
|
|
|
|
[metadata_constraint]: /docs/job-specification/constraint#user-specified-metadata 'Nomad User-Specified Metadata Constraint Example'
|
2020-10-15 14:20:56 +00:00
|
|
|
[task working directory]: /docs/runtime/environment#task-directories 'Task directories'
|
2021-04-20 17:55:10 +00:00
|
|
|
[go-sockaddr/template]: https://godoc.org/github.com/hashicorp/go-sockaddr/template
|