-
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
duplicate task.config.extra_hosts
to Connect sidecar tasks
#11056
Comments
Thank you for the report @DejfCold I was able to reproduce the issue as you described, and it seems to only happen when using Consul Connect (commenting out the |
I also encountered the problem in our cluster (using Nomad 1.1.3 & Consul 1.10.1). As for the workaround for now I created dnsmasq service with the extra_host parameters
and in the job, which needs to
|
@ollivainola are you using Consul Connect? |
@lgfa29 yes. The task where where I used the |
Thanks for the extra info @ollivainola. I've confirmed that #10823 broke |
job "countdash" {
# ...
group "dashboard" {
# ...
task "extra-hosts" {
driver = "docker"
config {
image = "busybox:1.33"
command = "/bin/sh"
args = ["local/extra_hosts.sh"]
}
template {
data = <<EOF
cat <<EOT >> /etc/hosts
127.0.0.1 freeipa.ingress.dc1.consul
EOT
EOF
destination = "local/extra_hosts.sh"
}
lifecycle {
hook = "prestart"
}
}
}
}
EDIT: Scratch all of that 😬 A better workaround would be to set the job "freeipa" {
datacenters = ["dc1"]
group "freeipa" {
network {
mode = "bridge"
}
service {
name = "freeipa"
port = "443"
connect {
sidecar_service {}
+ sidecar_task {
+ config {
+ extra_hosts = ["freeipa.ingress.dc1.consul:127.0.0.1"]
+ }
+ }
}
}
task "freeipa" {
resources {
memory = 2000
}
driver = "docker"
config {
image = "freeipa/freeipa-server:centos-8"
args = ["ipa-server-install", "-U", "-r", "DC1.CONSUL", "--no-ntp"]
sysctl = {
"net.ipv6.conf.all.disable_ipv6" = "0"
}
- extra_hosts = ["freeipa.ingress.dc1.consul:127.0.0.1"]
}
env {
HOSTNAME = "freeipa.ingress.dc1.consul"
PASSWORD = "testtest"
}
}
}
} |
Thanks for the workaround! |
Hum...good question. Even though there's a reasonable workaround I think we still need to provide a proper fix for this, so I will keep it open for now 👍 |
When setting |
Thank you very much, I had problem adding extra host on I need these extra hosts for my TLS setting to address to specific random private domain. |
While this is working roughly as intended, I'm going to re-title this and label it as an enhancement. There's probably some discussion to be had about whether the |
task.config.extra_hosts
to Connect sidecar tasks
Nomad version
Output from
nomad version
Nomad v1.1.3 (8c0c814)
Operating system and Environment details
Rocky Linux 8.4 (Green Obsidian)
Docker version 20.10.8, build 3967b7d
Issue
task.extra_hosts
is not propagated into the docker containers/etc/hosts
Reproduction steps
cat /etc/hosts
using eithernomad alloc exec
ordocker exec
on the allocation/containerExpected Result
Actual Result
Job file (if appropriate)
Nomad Server logs (if appropriate)
Nomad Client logs (if appropriate)
See also #7746 (comment)
The text was updated successfully, but these errors were encountered: