Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] where is the correct location (within the config) for consul.* #1056

Closed
ketzacoatl opened this issue Apr 8, 2016 · 12 comments
Closed

Comments

@ketzacoatl
Copy link
Contributor

I am confused about the proper use of the consul.* config parameters.

Nomad version

# nomad  version
Nomad v0.3.1

Operating system and Environment details

Ubuntu Linux 14.04 AMD64 on AWS.

Issue

https://www.nomadproject.io/docs/agent/config.html confusingly states:

The following is not an exhaustive list of options that can be passed to the Client, but rather the set of options that configure the Client and not the drivers.

..but when I put consul.address and consul.token into the client section of my config, I get:

==> Error loading configuration from /etc/nomad/config.json: Error loading /etc/nomad/config.json: error parsing 'config': 3 error(s) occurred:

* client -> invalid key: consul.address
* client -> invalid key: consul.token
* client -> invalid key: node_id

When I move those two parameters out of the client section to the root of the config, I get:

==> Error loading configuration from /etc/nomad/config.json: Error loading /etc/nomad/config.json: error parsing 'config': 2 error(s) occurred:

* config: invalid key: consul.address
* config: invalid key: consul.token

Agent config looks like:

{
  "addresses": {
    "http": "10.10.10.10"
  },
  "datacenter": "us-west-2",
  "data_dir": "/var/lib/nomad/tmp/",
  "disable_anonymous_signature": true,
  "disable_update_check": true,
  "enable_debug": false,
  "enable_syslog": true,
  "log_level": "INFO",
  "name": "foobar",
  "region": "us-west-2",
  "syslog_facility": "LOCAL0",
  "client": {
    "consul.address": "consul.service.consul:8500",
    "consul.token": "FOOBAR",
    "servers": [
      "nomad-server.service.consul:4647"
      ],
    "meta": {
      "role": "manage"
    },


    "node_id": "foobar",
    "options": {
      "driver.raw_exec.enable": "1"
    },
    "enabled": true
  }
}

When I worked with the nomad server config, I saw similar errors.

I am confused - How are the consul.* parameters intended to be used?

@iverberk
Copy link
Contributor

iverberk commented Apr 8, 2016

Hi ketzacoatl,

Try putting those parameters in the options block of the client setting. So it would look like this:

...
"client": {
...
  "options": {
    "consul.address": "url"
  },
...

It is described here: https://www.nomadproject.io/docs/agent/config.html#options_map

As an additional remark: make sure that you run Consul on every node so that Nomad can connect to it locally. I have seen weird behaviour when pointing Nomad clients to a single remote Consul location.

@ketzacoatl
Copy link
Contributor Author

OK, I see what that doc is trying to communicate, and that makes sense now. I will find a short but simple way to update the docs with an example here. One last question, is this options key available in the server block as well?

@iverberk
Copy link
Contributor

iverberk commented Apr 8, 2016

I don't believe it is available in the server block.

@ketzacoatl
Copy link
Contributor Author

OK, so only clients communicate with consul?
(that sounds reasonable, I'm just confirming)

@iverberk
Copy link
Contributor

iverberk commented Apr 8, 2016

That is correct, in the end they are responsible for actually running the tasks and registering them in Consul. The servers only determine the scheduling.

@ketzacoatl
Copy link
Contributor Author

Later in the day I will update this doc and submit a PR for review. Thanks for your help!

@ketzacoatl
Copy link
Contributor Author

Is there a reason why node_id in the client block would fail in a similar way? The docs clearly put node_id in the client block, but I see:

==> Error loading configuration from /etc/nomad/config.json: Error loading /etc/nomad/config.json: error parsing 'config': 1 error(s) occurred:

* client -> invalid key: node_id

config looks like:

    {
      "addresses": {
        "http": "10.10.10.11"
      },
      "datacenter": "us-west-2",
      "data_dir": "/var/lib/nomad/tmp/",
      "disable_anonymous_signature": true,
      "disable_update_check": true,
      "enable_debug": false,
      "enable_syslog": true,
      "log_level": "INFO",
      "name": "FOOBAR",
      "region": "us-west-2",
      "syslog_facility": "LOCAL0",
      "client": {
        "consul.address": "consul.service.consul:8500",
        "consul.token": "FOOBAR",
        "servers": [
          "nomad-server.service.consul:4647"
          ],
        "meta": {
          "role": "foobar"
        },


        "node_id": "FOOBAR",
        "options": {
          "driver.raw_exec.enable": "1"
        },
        "enabled": true
      }
    }

@iverberk
Copy link
Contributor

iverberk commented Apr 8, 2016

The node_id parameter should be removed from the documentation as it is no longer specifiable.
Check https://github.com/hashicorp/nomad/blob/master/CHANGELOG.md at the backwards incompatibilities for 0.3.0

@ketzacoatl
Copy link
Contributor Author

Ah, yes, ok, I'll hit that separately.

@diptanu
Copy link
Contributor

diptanu commented Apr 10, 2016

@ketzacoatl We are introducing a consul block very soon. so that would make configuring consul easier.

@diptanu diptanu closed this as completed Apr 10, 2016
@ketzacoatl
Copy link
Contributor Author

SGTM.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants