github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/configuration/server_join.mdx (about) 1 --- 2 layout: docs 3 page_title: server_join Stanza - Agent Configuration 4 sidebar_title: server_join 5 description: >- 6 The "server_join" stanza specifies how the Nomad agent will discover and 7 connect to Nomad servers. 8 --- 9 10 # `server_join` Stanza 11 12 <Placement 13 groups={[ 14 ['server', 'server_join'], 15 ['client', 'server_join'] 16 ]} 17 /> 18 19 The `server_join` stanza specifies how the Nomad agent will discover and connect 20 to Nomad servers. 21 22 ```hcl 23 server_join { 24 retry_join = [ "1.1.1.1", "2.2.2.2" ] 25 retry_max = 3 26 retry_interval = "15s" 27 } 28 ``` 29 30 ## `server_join` Parameters 31 32 - `retry_join` `(array<string>: [])` - Specifies a list of server addresses to 33 join. This is similar to [`start_join`](#start_join), but will continue to 34 be attempted even if the initial join attempt fails, up to 35 [retry_max](#retry_max). Further, `retry_join` is available to 36 both Nomad servers and clients, while `start_join` is only defined for Nomad 37 servers. This is useful for cases where we know the address will become 38 available eventually. Use `retry_join` with an array as a replacement for 39 `start_join`, **do not use both options**. 40 41 Address format includes both using IP addresses as well as an interface to the 42 [go-discover](https://github.com/hashicorp/go-discover) library for doing 43 automated cluster joining using cloud metadata. See the [Cloud Auto-join](#cloud-auto-join) 44 section below for more information. 45 46 ``` 47 server_join { 48 retry_join = [ "1.1.1.1", "2.2.2.2" ] 49 } 50 ``` 51 52 Using the `go-discover` interface, this can be defined both in a client or 53 server configuration as well as provided as a command-line argument. 54 55 ``` 56 server_join { 57 retry_join = [ "provider=aws tag_key=..." ] 58 } 59 ``` 60 61 See the [server address format](#server-address-format) for more information about expected 62 server address formats. 63 64 - `retry_interval` `(string: "30s")` - Specifies the time to wait between retry 65 join attempts. 66 67 - `retry_max` `(int: 0)` - Specifies the maximum number of join attempts to be 68 made before exiting with a return code of 1. By default, this is set to 0 69 which is interpreted as infinite retries. 70 71 - `start_join` `(array<string>: [])` - Specifies a list of server addresses to 72 join on startup. If Nomad is unable to join with any of the specified 73 addresses, agent startup will fail. See the 74 [server address format](#server-address-format) section for more information 75 on the format of the string. This field is defined only for Nomad servers and 76 will result in a configuration parse error if included in a client 77 configuration. 78 79 ## Server Address Format 80 81 This section describes the acceptable syntax and format for describing the 82 location of a Nomad server. There are many ways to reference a Nomad server, 83 including directly by IP address and resolving through DNS. 84 85 ### Directly via IP Address 86 87 It is possible to address another Nomad server using its IP address. This is 88 done in the `ip:port` format, such as: 89 90 ``` 91 1.2.3.4:5678 92 ``` 93 94 If the port option is omitted, it defaults to the Serf port, which is 4648 95 unless configured otherwise: 96 97 ``` 98 1.2.3.4 => 1.2.3.4:4648 99 ``` 100 101 ### Via Domains or DNS 102 103 It is possible to address another Nomad server using its DNS address. This is 104 done in the `address:port` format, such as: 105 106 ``` 107 nomad-01.company.local:5678 108 ``` 109 110 If the port option is omitted, it defaults to the Serf port, which is 4648 111 unless configured otherwise: 112 113 ``` 114 nomad-01.company.local => nomad-01.company.local:4648 115 ``` 116 117 ### Via the go-discover interface 118 119 As of Nomad 0.8.4, `retry_join` accepts a unified interface using the 120 [go-discover](https://github.com/hashicorp/go-discover) library for doing 121 automated cluster joining using cloud metadata. See [Cloud 122 Auto-join][#cloud_auto_join] for more information. 123 124 ``` 125 "provider=aws tag_key=..." => 1.2.3.4:4648 126 ``` 127 128 ## Cloud Auto-join 129 130 The following sections describe the Cloud Auto-join `retry_join` options that are specific 131 to a subset of supported cloud providers. For information on all providers, see further 132 documentation in [go-discover](https://github.com/hashicorp/go-discover). 133 134 ### Amazon EC2 135 136 This returns the first private IP address of all servers in the given 137 region which have the given `tag_key` and `tag_value`. 138 139 ```json 140 { 141 "retry_join": ["provider=aws tag_key=... tag_value=..."] 142 } 143 ``` 144 145 - `provider` (required) - the name of the provider ("aws" in this case). 146 - `tag_key` (required) - the key of the tag to auto-join on. 147 - `tag_value` (required) - the value of the tag to auto-join on. 148 - `region` (optional) - the AWS region to authenticate in. 149 - `addr_type` (optional) - the type of address to discover: `private_v4`, `public_v4`, `public_v6`. Default is `private_v4`. (>= 1.0) 150 - `access_key_id` (optional) - the AWS access key for authentication (see below for more information about authenticating). 151 - `secret_access_key` (optional) - the AWS secret access key for authentication (see below for more information about authenticating). 152 153 #### Authentication & Precedence 154 155 - Static credentials `access_key_id=... secret_access_key=...` 156 - Environment variables (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`) 157 - Shared credentials file (`~/.aws/credentials` or the path specified by `AWS_SHARED_CREDENTIALS_FILE`) 158 - ECS task role metadata (container-specific). 159 - EC2 instance role metadata. 160 161 The only required IAM permission is `ec2:DescribeInstances`, and it is 162 recommended that you make a dedicated key used only for auto-joining. If the 163 region is omitted it will be discovered through the local instance's [EC2 164 metadata 165 endpoint](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html). 166 167 ### Microsoft Azure 168 169 This returns the first private IP address of all servers in the given region 170 which have the given `tag_key` and `tag_value` in the tenant and subscription, or in 171 the given `resource_group` of a `vm_scale_set` for Virtual Machine Scale Sets. 172 173 ```json 174 { 175 "retry_join": [ 176 "provider=azure tag_name=... tag_value=... tenant_id=... client_id=... subscription_id=... secret_access_key=..." 177 ] 178 } 179 ``` 180 181 - `provider` (required) - the name of the provider ("azure" in this case). 182 - `tenant_id` (required) - the tenant to join machines in. 183 - `client_id` (required) - the client to authenticate with. 184 - `secret_access_key` (required) - the secret client key. 185 186 Use these configuration parameters when using tags: 187 188 - `tag_name` - the name of the tag to auto-join on. 189 - `tag_value` - the value of the tag to auto-join on. 190 191 Use these configuration parameters when using Virtual Machine Scale Sets (Consul 1.0.3 and later): 192 193 - `resource_group` - the name of the resource group to filter on. 194 - `vm_scale_set` - the name of the virtual machine scale set to filter on. 195 196 When using tags the only permission needed is the `ListAll` method for `NetworkInterfaces`. When using 197 Virtual Machine Scale Sets the only role action needed is `Microsoft.Compute/virtualMachineScaleSets/*/read`. 198 199 ### Google Compute Engine 200 201 This returns the first private IP address of all servers in the given 202 project which have the given `tag_value`. 203 204 ```` 205 206 ```json 207 { 208 "retry_join": ["provider=gce project_name=... tag_value=..."] 209 } 210 ```` 211 212 - `provider` (required) - the name of the provider ("gce" in this case). 213 - `tag_value` (required) - the value of the tag to auto-join on. 214 - `project_name` (optional) - the name of the project to auto-join on. Discovered if not set. 215 - `zone_pattern` (optional) - the list of zones can be restricted through an RE2 compatible regular expression. If omitted, servers in all zones are returned. 216 - `credentials_file` (optional) - the credentials file for authentication. See below for more information. 217 218 #### Authentication & Precedence 219 220 - Use credentials from `credentials_file`, if provided. 221 - Use JSON file from `GOOGLE_APPLICATION_CREDENTIALS` environment variable. 222 - Use JSON file in a location known to the gcloud command-line tool. 223 - On Windows, this is `%APPDATA%/gcloud/application_default_credentials.json`. 224 - On other systems, `$HOME/.config/gcloud/application_default_credentials.json`. 225 - On Google Compute Engine, use credentials from the metadata 226 server. In this final case any provided scopes are ignored. 227 228 Discovery requires a [GCE Service 229 Account](https://cloud.google.com/compute/docs/access/service-accounts). 230 Credentials are searched using the following paths, in order of precedence.