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