-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Service registration for IPv6 docker addresses (Fixes #3785) #3790
Changes from 1 commit
795d84e
dea460b
cdd55e4
d0dd6ef
51bf06f
e486a27
5ff86f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,6 +355,11 @@ The `docker` driver supports the following configuration in the job spec. Only | |
] | ||
} | ||
``` | ||
* `use_ipv6_address` - (Optional) `true` or `false` (default). Use IPv6 Address | ||
will use the containers IPv6 address (GlobalIPv6Address) when registering service checks and using | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
`address_mode = driver`. | ||
See [service](/docs/job-specification/service.html) for details. | ||
|
||
|
||
* `readonly_rootfs` - (Optional) `true` or `false` (default). Mount | ||
the container's filesystem as read only. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,9 @@ does not automatically enable service discovery. | |
`address_mode="driver"`. Numeric ports may be used when in driver addressing | ||
mode. | ||
|
||
Docker and IPv6 containers: This setting is required if you want to register | ||
the port of the (IPv6) service. See [below for examples.](#IPv6 docker containers) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we set |
||
|
||
- `tags` `(array<string>: [])` - Specifies the list of tags to associate with | ||
this service. If this is not supplied, no tags will be assigned to the service | ||
when it is registered. | ||
|
@@ -124,6 +127,10 @@ does not automatically enable service discovery. | |
addresses. Task will fail if driver network cannot be determined. Only | ||
implemented for Docker and rkt. | ||
|
||
Docker and IPv6 containers: If you want to register the IPv6 address | ||
of the container you'll have to enable this and specify `use_ipv6_address` | ||
in the docker driver configuration. See [below for examples.](#IPv6 docker containers) | ||
|
||
- `host` - Use the host IP and port. | ||
|
||
### `check` Parameters | ||
|
@@ -140,6 +147,10 @@ scripts. | |
[below for details.](#using-driver-address-mode) Unlike `port`, this setting | ||
is *not* inherited from the `service`. | ||
|
||
Docker and IPv6 containers: If you want to check the IPv6 address | ||
of the container you'll have to enable this and specify `use_ipv6_address` | ||
in the docker driver configuration. See [below for examples.](#IPv6 docker containers) | ||
|
||
- `args` `(array<string>: [])` - Specifies additional arguments to the | ||
`command`. This only applies to script-based health checks. | ||
|
||
|
@@ -186,6 +197,9 @@ scripts. | |
default. In Nomad 0.7.1 or later numeric ports may be used if | ||
`address_mode="driver"` is set on the check. | ||
|
||
Docker and IPv6 containers: Using a numeric port is required if you want to | ||
check the port of (IPv6) service. See [below for examples.](#IPv6 docker containers) | ||
|
||
- `protocol` `(string: "http")` - Specifies the protocol for the http-based | ||
health checks. Valid options are `http` and `https`. | ||
|
||
|
@@ -463,6 +477,62 @@ In this case Nomad doesn't need to assign Redis any host ports. The `service` | |
and `check` stanzas can both specify the port number to advertise and check | ||
directly since Nomad isn't managing any port assignments. | ||
|
||
### IPv6 docker containers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docker -> Docker |
||
|
||
The [Docker](/docs/drivers/docker.html#use_ipv6_address) driver support the | ||
`use_ipv6_address` parameter in it's configuration. | ||
|
||
Besides enabling this parameter you have to set `address_mode` parameter in | ||
both `service` and `check` stanzas to `driver`. | ||
|
||
You also have explicily specify the `port` that will be registered and checked. | ||
|
||
For example | ||
|
||
```hcl | ||
job "example" { | ||
datacenters = ["dc1"] | ||
group "cache" { | ||
|
||
task "redis" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "redis:3.2" | ||
use_ipv6_address = true | ||
# No port map required! | ||
} | ||
|
||
resources { | ||
cpu = 500 # 500 MHz | ||
memory = 256 # 256MB | ||
network { | ||
mbits = 10 | ||
} | ||
} | ||
|
||
service { | ||
name = "ipv6-redis" | ||
port = 6379 | ||
address_mode = "driver" | ||
check { | ||
name = "ipv6-redis-check" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "2s" | ||
port = 6379 | ||
address_mode = "driver" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
With IPv6 Nomad doesn't need to assign Redis any host ports. The `service` | ||
and `check` stanzas can both specify the port number to advertise and check | ||
directly since Nomad isn't managing any port assignments. | ||
|
||
|
||
- - - | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, it seems like we probably want to set
auto = true
here as well. While this complicates the already unfortunately confusingadvertise = "auto"
logic, I think it will do what users expect by automatically advertising the routable address for the container when it's possible to discover it.Perhaps a better question is: It should be exceedingly rare that someone wants
use_ipv6_address = true
andadvertise = "host"
, correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this has been addressed; leaving for historical purposes)