Hello,
nomad -v
Nomad v0.12.9 (45c139e53f2407a44b1290385b5818b46ea3a62c)
consul -v
Consul v1.8.4
Revision 12b16df32
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
I try to exec simple job mariadb:
job "mariadb" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "database" {
count = 1
network {
mode = "bridge"
port "db" {
to = 3306
}
}
service {
name = "mariadb"
port = "db"
tags = [
"traefik.enable=true",
"traefik.tcp.routers.mariadb.rule=HostSNI(`*`)",
"traefik.tcp.routers.mariadb.service=mariadb",
"traefik.tcp.services.mariadb.loadbalancer.server.port=3306",
]
check {
type = "tcp"
port = "db"
interval = "10s"
timeout = "2s"
}
}
task "mariadb" {
driver = "docker"
config {
image = "mariadb:10.5.8"
network_mode = "database"
volumes = [
"/srv/live/mariadb/data:/var/lib/mysql",
]
}
env = {
"MYSQL_ROOT_PASSWORD" = "password"
}
}
}
}
FAILED! :’(
I have this error:
failed to setup alloc: pre-run hook "network" failed: failed to configure networking for alloc: failed to initialize table forwarding rules: failed to list iptables chains: running [/usr/sbin/iptables -t filter -S --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
And in systemctl journal:
Dec 10 11:39:00 portecontainer nomad[919503]: 2020-12-10T11:39:00.095+0100 [INFO] client.gc: marking allocation for GC: alloc_id=258600ec-5567-53ef-f63e-95c5e611092f
Dec 10 11:39:00 portecontainer nomad[919503]: client.gc: marking allocation for GC: alloc_id=258600ec-5567-53ef-f63e-95c5e611092f
Dec 10 11:39:00 portecontainer nomad[919503]: 2020-12-10T11:39:00.095+0100 [ERROR] client.alloc_runner.runner_hook: failed to cleanup network for allocation, resources may have leaked: alloc_id=258600ec-5567-53ef-f63e-95c5e611092f alloc=258600ec-5567-53ef-f63e-95c5e611092f error="failed to find plugin "portmap" in path [/opt/cni/bin]"
Dec 10 11:39:00 portecontainer nomad[919503]: client.alloc_runner.runner_hook: failed to cleanup network for allocation, resources may have leaked: alloc_id=258600ec-5567-53ef-f63e-95c5e611092f alloc=258600ec-5567-53ef-f63e-95c5e611092f error="failed to find plugin "portmap" in path [/opt/cni/bin]"
I see in other topic to enable consul connect, that I add in consul config.json:
"connect": {
"enabled": true
}
But no more works.
My job Traefik works fine.
An you help me?
Thanks