github.com/quite/nomad@v0.8.6/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: varied)` - Specifies the name of the interface 53 to force network fingerprinting on. When run in dev mode, this defaults to the 54 loopback interface. When not in dev mode, the interface attached to the 55 default route is used. All IP addresses except those scoped local for IPV6 on 56 the chosen interface are fingerprinted. The scheduler chooses from those IP 57 addresses when allocating ports for tasks. 58 59 - `network_speed` `(int: 0)` - Specifies an override for the network link speed. 60 This value, if set, overrides any detected or defaulted link speed. Most 61 clients can determine their speed automatically, and thus in most cases this 62 should be left unset. 63 64 - `cpu_total_compute` `(int: 0)` - Specifies an override for the total CPU 65 compute. This value should be set to `# Cores * Core MHz`. For example, a 66 quad-core running at 2 GHz would have a total compute of 8000 (4 * 2000). Most 67 clients can determine their total CPU compute automatically, and thus in most 68 cases this should be left unset. 69 70 - `memory_total_mb` `(int:0)` - Specifies an override for the total memory. If set, 71 this value overrides any detected memory. 72 73 - `node_class` `(string: "")` - Specifies an arbitrary string used to logically 74 group client nodes by user-defined class. This can be used during job 75 placement as a filter. 76 77 - `options` <code>([Options](#options-parameters): nil)</code> - Specifies a 78 key-value mapping of internal configuration for clients, such as for driver 79 configuration. 80 81 - `reserved` <code>([Reserved](#reserved-parameters): nil)</code> - Specifies 82 that Nomad should reserve a portion of the node's resources from receiving 83 tasks. This can be used to target a certain capacity usage for the node. For 84 example, 20% of the node's CPU could be reserved to target a CPU utilization 85 of 80%. 86 87 - `servers` `(array<string>: [])` - Specifies an array of addresses to the Nomad 88 servers this client should join. This list is used to register the client with 89 the server nodes and advertise the available resources so that the agent can 90 receive work. This may be specified as an IP address or DNS, with or without 91 the port. If the port is omitted, the default port of `4647` is used. 92 93 - `server_join` <code>([server_join][server-join]: nil)</code> - Specifies 94 how the Nomad client will connect to Nomad servers. The `start_join` field 95 is not supported on the client. The retry_join fields may directly specify 96 the server address or use go-discover syntax for auto-discovery. See the 97 documentation for more detail. 98 99 - `state_dir` `(string: "[data_dir]/client")` - Specifies the directory to use 100 to store client state. By default, this is - the top-level 101 [data_dir](/docs/agent/configuration/index.html#data_dir) suffixed with 102 "client", like `"/opt/nomad/client"`. This must be an absolute path. 103 104 - `gc_interval` `(string: "1m")` - Specifies the interval at which Nomad 105 attempts to garbage collect terminal allocation directories. 106 107 - `gc_disk_usage_threshold` `(float: 80)` - Specifies the disk usage percent which 108 Nomad tries to maintain by garbage collecting terminal allocations. 109 110 - `gc_inode_usage_threshold` `(float: 70)` - Specifies the inode usage percent 111 which Nomad tries to maintain by garbage collecting terminal allocations. 112 113 - `gc_max_allocs` `(int: 50)` - Specifies the maximum number of allocations 114 which a client will track before triggering a garbage collection of terminal 115 allocations. This will *not* limit the number of allocations a node can run at 116 a time, however after `gc_max_allocs` every new allocation will cause terminal 117 allocations to be GC'd. 118 119 - `gc_parallel_destroys` `(int: 2)` - Specifies the maximum number of 120 parallel destroys allowed by the garbage collector. This value should be 121 relatively low to avoid high resource usage during garbage collections. 122 123 - `no_host_uuid` `(bool: true)` - By default a random node UUID will be 124 generated, but setting this to `false` will use the system's UUID. Before 125 Nomad 0.6 the default was to use the system UUID. 126 127 ### `chroot_env` Parameters 128 129 Drivers based on [isolated fork/exec](/docs/drivers/exec.html) implement file 130 system isolation using chroot on Linux. The `chroot_env` map allows the chroot 131 environment to be configured using source paths on the host operating system. 132 The mapping format is: 133 134 ```text 135 source_path -> dest_path 136 ``` 137 138 The following example specifies a chroot which contains just enough to run the 139 `ls` utility: 140 141 ```hcl 142 client { 143 chroot_env { 144 "/bin/ls" = "/bin/ls" 145 "/etc/ld.so.cache" = "/etc/ld.so.cache" 146 "/etc/ld.so.conf" = "/etc/ld.so.conf" 147 "/etc/ld.so.conf.d" = "/etc/ld.so.conf.d" 148 "/lib" = "/lib" 149 "/lib64" = "/lib64" 150 } 151 } 152 ``` 153 154 When `chroot_env` is unspecified, the `exec` driver will use a default chroot 155 environment with the most commonly used parts of the operating system. Please 156 see the [Nomad `exec` driver documentation](/docs/drivers/exec.html#chroot) for 157 the full list. 158 159 ### `options` Parameters 160 161 The following is not an exhaustive list of options for only the Nomad 162 client. To find the options supported by each individual Nomad driver, please 163 see the [drivers documentation](/docs/drivers/index.html). 164 165 - `"driver.whitelist"` `(string: "")` - Specifies a comma-separated list of 166 whitelisted drivers . If specified, drivers not in the whitelist will be 167 disabled. If the whitelist is empty, all drivers are fingerprinted and enabled 168 where applicable. 169 170 ```hcl 171 client { 172 options = { 173 "driver.whitelist" = "docker,qemu" 174 } 175 } 176 ``` 177 178 - `"driver.blacklist"` `(string: "")` - Specifies a comma-separated list of 179 blacklisted drivers . If specified, drivers in the blacklist will be 180 disabled. 181 182 ```hcl 183 client { 184 options = { 185 "driver.blacklist" = "docker,qemu" 186 } 187 } 188 ``` 189 190 - `"env.blacklist"` `(string: see below)` - Specifies a comma-separated list of 191 environment variable keys not to pass to these tasks. Nomad passes the host 192 environment variables to `exec`, `raw_exec` and `java` tasks. If specified, 193 the defaults are overridden. If a value is provided, **all** defaults are 194 overridden (they are not merged). 195 196 ```hcl 197 client { 198 options = { 199 "env.blacklist" = "MY_CUSTOM_ENVVAR" 200 } 201 } 202 ``` 203 204 The default list is: 205 206 ```text 207 CONSUL_TOKEN 208 VAULT_TOKEN 209 AWS_ACCESS_KEY_ID 210 AWS_SECRET_ACCESS_KEY 211 AWS_SESSION_TOKEN 212 GOOGLE_APPLICATION_CREDENTIALS 213 ``` 214 215 - `"user.blacklist"` `(string: see below)` - Specifies a comma-separated 216 blacklist of usernames for which a task is not allowed to run. This only 217 applies if the driver is included in `"user.checked_drivers"`. If a value is 218 provided, **all** defaults are overridden (they are not merged). 219 220 ```hcl 221 client { 222 options = { 223 "user.blacklist" = "root,ubuntu" 224 } 225 } 226 ``` 227 228 The default list is: 229 230 ```text 231 root 232 Administrator 233 ``` 234 235 - `"user.checked_drivers"` `(string: see below)` - Specifies a comma-separated 236 list of drivers for which to enforce the `"user.blacklist"`. For drivers using 237 containers, this enforcement is usually unnecessary. If a value is provided, 238 **all** defaults are overridden (they are not merged). 239 240 ```hcl 241 client { 242 options = { 243 "user.checked_drivers" = "exec,raw_exec" 244 } 245 } 246 ``` 247 248 The default list is: 249 250 ```text 251 exec 252 qemu 253 java 254 ``` 255 256 - `"fingerprint.whitelist"` `(string: "")` - Specifies a comma-separated list of 257 whitelisted fingerprinters. If specified, any fingerprinters not in the 258 whitelist will be disabled. If the whitelist is empty, all fingerprinters are 259 used. 260 261 ```hcl 262 client { 263 options = { 264 "fingerprint.whitelist" = "network" 265 } 266 } 267 ``` 268 269 - `"fingerprint.blacklist"` `(string: "")` - Specifies a comma-separated list of 270 blacklisted fingerprinters. If specified, any fingerprinters in the blacklist 271 will be disabled. 272 273 ```hcl 274 client { 275 options = { 276 "fingerprint.blacklist" = "network" 277 } 278 } 279 ``` 280 281 - `"fingerprint.network.disallow_link_local"` `(string: "false")` - Specifies 282 whether the network fingerprinter should ignore link-local addresses in the 283 case that no globally routable address is found. The fingerprinter will always 284 prefer globally routable addresses. 285 286 ```hcl 287 client { 288 options = { 289 "fingerprint.network.disallow_link_local" = "true" 290 } 291 } 292 ``` 293 294 ### `reserved` Parameters 295 296 - `cpu` `(int: 0)` - Specifies the amount of CPU to reserve, in MHz. 297 298 - `memory` `(int: 0)` - Specifies the amount of memory to reserve, in MB. 299 300 - `disk` `(int: 0)` - Specifies the amount of disk to reserve, in MB. 301 302 - `reserved_ports` `(string: "")` - Specifies a comma-separated list of ports to 303 reserve on all fingerprinted network devices. Ranges can be specified by using 304 a hyphen separated the two inclusive ends. 305 306 ## `client` Examples 307 308 ### Common Setup 309 310 This example shows the most basic configuration for a Nomad client joined to a 311 cluster. 312 313 ```hcl 314 client { 315 enabled = true 316 server_join { 317 retry_join = [ "1.1.1.1", "2.2.2.2" ] 318 retry_max = 3 319 retry_interval = "15s" 320 } 321 } 322 ``` 323 324 ### Reserved Resources 325 326 This example shows a sample configuration for reserving resources to the client. 327 This is useful if you want to allocate only a portion of the client's resources 328 to jobs. 329 330 ```hcl 331 client { 332 enabled = true 333 334 reserved { 335 cpu = 500 336 memory = 512 337 disk = 1024 338 reserved_ports = "22,80,8500-8600" 339 } 340 } 341 ``` 342 343 ### Custom Metadata, Network Speed, and Node Class 344 345 This example shows a client configuration which customizes the metadata, network 346 speed, and node class. 347 348 ```hcl 349 client { 350 enabled = true 351 network_speed = 500 352 node_class = "prod" 353 354 meta { 355 "owner" = "ops" 356 } 357 } 358 ``` 359 [server-join]: /docs/agent/configuration/server_join.html "Server Join"