github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/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 quad-core running at 2 GHz 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_max_allocs` `(int: 50)` - Specifies the maximum number of allocations 104 which a client will track before triggering a garbage collection of terminal 105 allocations. This will *not* limit the number of allocations a node can run at 106 a time, however after `gc_max_allocs` every new allocation will cause terminal 107 allocations to be GC'd. 108 109 - `gc_parallel_destroys` `(int: 2)` - Specifies the maximum number of 110 parallel destroys allowed by the garbage collector. This value should be 111 relatively low to avoid high resource usage during garbage collections. 112 113 - `no_host_uuid` `(bool: true)` - By default a random node UUID will be 114 generated, but setting this to `false` will use the system's UUID. Before 115 Nomad 0.6 the default was to use the system UUID. 116 117 ### `chroot_env` Parameters 118 119 Drivers based on [isolated fork/exec](/docs/drivers/exec.html) implement file 120 system isolation using chroot on Linux. The `chroot_env` map allows the chroot 121 environment to be configured using source paths on the host operating system. 122 The mapping format is: 123 124 ```text 125 source_path -> dest_path 126 ``` 127 128 The following example specifies a chroot which contains just enough to run the 129 `ls` utility: 130 131 ```hcl 132 client { 133 chroot_env { 134 "/bin/ls" = "/bin/ls" 135 "/etc/ld.so.cache" = "/etc/ld.so.cache" 136 "/etc/ld.so.conf" = "/etc/ld.so.conf" 137 "/etc/ld.so.conf.d" = "/etc/ld.so.conf.d" 138 "/lib" = "/lib" 139 "/lib64" = "/lib64" 140 } 141 } 142 ``` 143 144 When `chroot_env` is unspecified, the `exec` driver will use a default chroot 145 environment with the most commonly used parts of the operating system. Please 146 see the [Nomad `exec` driver documentation](/docs/drivers/exec.html#chroot) for 147 the full list. 148 149 ### `options` Parameters 150 151 The following is not an exhaustive list of options for only the Nomad 152 client. To find the options supported by each individual Nomad driver, please 153 see the [drivers documentation](/docs/drivers/index.html). 154 155 - `"driver.whitelist"` `(string: "")` - Specifies a comma-separated list of 156 whitelisted drivers . If specified, drivers not in the whitelist will be 157 disabled. If the whitelist is empty, all drivers are fingerprinted and enabled 158 where applicable. 159 160 ```hcl 161 client { 162 options = { 163 "driver.whitelist" = "docker,qemu" 164 } 165 } 166 ``` 167 168 - `"driver.blacklist"` `(string: "")` - Specifies a comma-separated list of 169 blacklisted drivers . If specified, drivers in the blacklist will be 170 disabled. 171 172 ```hcl 173 client { 174 options = { 175 "driver.blacklist" = "docker,qemu" 176 } 177 } 178 ``` 179 180 - `"env.blacklist"` `(string: see below)` - Specifies a comma-separated list of 181 environment variable keys not to pass to these tasks. Nomad passes the host 182 environment variables to `exec`, `raw_exec` and `java` tasks. If specified, 183 the defaults are overridden. If a value is provided, **all** defaults are 184 overridden (they are not merged). 185 186 ```hcl 187 client { 188 options = { 189 "env.blacklist" = "MY_CUSTOM_ENVVAR" 190 } 191 } 192 ``` 193 194 The default list is: 195 196 ```text 197 CONSUL_TOKEN 198 VAULT_TOKEN 199 AWS_ACCESS_KEY_ID 200 AWS_SECRET_ACCESS_KEY 201 AWS_SESSION_TOKEN 202 GOOGLE_APPLICATION_CREDENTIALS 203 ``` 204 205 - `"user.blacklist"` `(string: see below)` - Specifies a comma-separated 206 blacklist of usernames for which a task is not allowed to run. This only 207 applies if the driver is included in `"user.checked_drivers"`. If a value is 208 provided, **all** defaults are overridden (they are not merged). 209 210 ```hcl 211 client { 212 options = { 213 "user.blacklist" = "root,ubuntu" 214 } 215 } 216 ``` 217 218 The default list is: 219 220 ```text 221 root 222 Administrator 223 ``` 224 225 - `"user.checked_drivers"` `(string: see below)` - Specifies a comma-separated 226 list of drivers for which to enforce the `"user.blacklist"`. For drivers using 227 containers, this enforcement is usually unnecessary. If a value is provided, 228 **all** defaults are overridden (they are not merged). 229 230 ```hcl 231 client { 232 options = { 233 "user.checked_drivers" = "exec,raw_exec" 234 } 235 } 236 ``` 237 238 The default list is: 239 240 ```text 241 exec 242 qemu 243 java 244 ``` 245 246 - `"fingerprint.whitelist"` `(string: "")` - Specifies a comma-separated list of 247 whitelisted fingerprinters. If specified, any fingerprinters not in the 248 whitelist will be disabled. If the whitelist is empty, all fingerprinters are 249 used. 250 251 ```hcl 252 client { 253 options = { 254 "fingerprint.whitelist" = "network" 255 } 256 } 257 ``` 258 259 - `"fingerprint.blacklist"` `(string: "")` - Specifies a comma-separated list of 260 blacklisted fingerprinters. If specified, any fingerprinters in the blacklist 261 will be disabled. 262 263 ```hcl 264 client { 265 options = { 266 "fingerprint.blacklist" = "network" 267 } 268 } 269 ``` 270 271 ### `reserved` Parameters 272 273 - `cpu` `(int: 0)` - Specifies the amount of CPU to reserve, in MHz. 274 275 - `memory` `(int: 0)` - Specifies the amount of memory to reserve, in MB. 276 277 - `disk` `(int: 0)` - Specifies the amount of disk to reserve, in MB. 278 279 - `reserved_ports` `(string: "")` - Specifies a comma-separated list of ports to 280 reserve on all fingerprinted network devices. Ranges can be specified by using 281 a hyphen separated the two inclusive ends. 282 283 ## `client` Examples 284 285 ### Common Setup 286 287 This example shows the most basic configuration for a Nomad client joined to a 288 cluster. 289 290 ```hcl 291 client { 292 enabled = true 293 servers = ["1.2.3.4:4647", "5.6.7.8:4647"] 294 } 295 ``` 296 297 ### Reserved Resources 298 299 This example shows a sample configuration for reserving resources to the client. 300 This is useful if you want to allocate only a portion of the client's resources 301 to jobs. 302 303 ```hcl 304 client { 305 enabled = true 306 307 reserved { 308 cpu = 500 309 memory = 512 310 disk = 1024 311 reserved_ports = "22,80,8500-8600" 312 } 313 } 314 ``` 315 316 ### Custom Metadata, Network Speed, and Node Class 317 318 This example shows a client configuration which customizes the metadata, network 319 speed, and node class. 320 321 ```hcl 322 client { 323 enabled = true 324 network_speed = 500 325 node_class = "prod" 326 327 meta { 328 "owner" = "ops" 329 } 330 } 331 ```