job "postgres-service" {
datacenters = ["dc1"]
group "db" {
count = 1
network {
mode = "bridge"
port "db" {
to = 5432
}
}
service {
name = "postgres-db"
port = "db"
connect {
sidecar_service {}
}
}
task "postgres" {
driver = "docker"
config {
image = "postgres:14"
ports = ["db"]
}
env {
POSTGRES_DB = "mydb"
POSTGRES_USER = "user"
POSTGRES_PASSWORD = "password"
}
}
}
}
I have a very funny error setting up a very simple postgres db with consul connect enabled, but i seem to have this error. How can i resolve this issue
nomad error: consul_si_token: rpc error: rpc: can't find method Node.DeriveSIToken
job "postgres" {
update {
healthy_deadline = "9m59s"
}
type = "system"
group "postgres" {
network {
mode = "bridge"
port "envoy-metrics" {}
}
volume "postgres" {
type = "host"
read_only = false
source = "postgres"
}
constraint {
attribute = "${attr.unique.hostname}"
operator = "regexp"
value = "SMTRL-P01"
}
service {
name = "postgres"
port = "5432"
meta {
envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}" # make envoy metrics port available in Consul
}
connect {
sidecar_service {
proxy {
transparent_proxy {}
expose {
path {
path = "/metrics"
protocol = "http"
local_path_port = 9102
listener_port = "envoy-metrics"
}
}
}
}
}
}
task "postgres" {
driver = "docker"
volume_mount {
volume = "postgres"
destination = "/var/lib/postgresql/data"
read_only = false
}
config {
image = "postgres:14.18"
}
env {
POSTGRES_DB = "xxx"
POSTGRES_USER = "xxx"
POSTGRES_PASSWORD = "xxx"
}
resources {
cpu = 256
memory = 256
}
}
}
}
Here’s mine if it helps.
In dependents, you simply connect via:
DB_POSTGRESDB_HOST="postgres.virtual.consul"
Make sure you’ve enabled the intentions.
But looks like you might have an ACL/workload-identity issue.