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