Alloc is healthy but stucks in pending state
Author: suikast42Created Sep 22, 2026Updated Sep 25, 2026
Labelstype/bug
Nomad version
Nomad v2.0.7 BuildDate 2026-09-17T17:24:03Z Revision 9dcbdc5e64ecc4ec63e42b225af729c87c87cf83
Consul version
Consul v2.0.3 Revision d0f2be93 Build Date 2026-08-07T14:52:33Z Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
Operating system and Environment details
Ubuntu 26.04.1 LTS Docker version 29.8.1, build 4a63305
The alloc for 'loki' in that case but that can differ is up an running. I can't see any issues with that task but nomad shows me as in pending state.
The job is healthy but nomad says it is pending.
Here is my job file
variable "org" {
type = string
description = "Default organisation"
default = "cloud.private"
}
variable "env" {
type = string
description = "environment like prod dev testing"
default = "dev"
}
variable "version_blackbox_exporter" {
type = string
description = "Version blackbox exporter"
default = "0.24.0"
}
variable "version_logunifer" {
type = string
description = "Version logunifer"
default = "1.3.5"
}
variable "version_nats_prometheus_exporter" {
type = string
description = "Version nats exporter"
default = "0.20.2"
}
variable "version_nats_server" {
type = string
description = "Version nats server"
default = "2.15.0"
}
variable "version_nats_server_ui" {
type = string
description = "Version nats server"
default = "0.9.2"
}
variable "version_grafana_alloy" {
type = string
description = "Version grafana alloy"
default = "1.19.2"
}
variable "grafana_alloy_livedebug" {
type = bool
description = "Enables the live debugging feature, which streams real-time data from your components directly to the Alloy UI."
default = "false"
}
variable "version_grafana_nomadder" {
type = string
description = "Version grafana exporter"
default = "13.2.2.1"
}
variable "version_grafana_mimir" {
type = string
description = "Version grafana tempo"
default = "3.2.1"
}
variable "version_grafana_loki" {
type = string
description = "Version grafana loki"
default = "3.7.8"
}
variable "version_grafana_tempo" {
type = string
description = "Version grafana tempo"
default = "3.0.3"
}
variable "version_busy_box_init_container" {
type = string
description = "Version busibox"
default = "1.38.0"
}
job "observability" {
# Enable this for redeploy all the job file even if nothing changed
# meta {
# run_uuid = "${uuidv4()}"
# }
#
type = "service"
datacenters = ["nomadder1"]
reschedule {
delay = "10s"
delay_function = "exponential"
max_delay = "1m"
unlimited = true
}
update {
health_check = "checks"
max_parallel = 1
# Alloc is marked as unhealthy after this time
healthy_deadline = "5m"
auto_revert = true
# Mark the task as healthy after 10s positive check
min_healthy_time = "10s"
# Task is dead after failed checks in 1h
progress_deadline = "1h"
}
group "grafana" {
restart {
attempts = 5
interval = "10m"
delay = "15s"
mode = "delay"
}
volume "stack_observability_grafana_volume" {
type = "host"
source = "stack_observability_grafana_volume"
read_only = false
}
count = 1
network {
mode = "bridge"
port "ui" {
to = 3000
}
}
service {
name = "grafana"
port = "ui"
#port = "3000"
tags = [
"traefik.enable=true",
"traefik.http.routers.grafana.tls=true",
"traefik.http.routers.grafana.rule=Host(`grafana.cloud.private`)",
]
check {
name = "health"
type = "http"
port = "ui"
path = "/healthz"
interval = "10s"
timeout = "2s"
check_restart {
limit = 3
grace = "60s"
ignore_warnings = false
}
}
}
task "grafana" {
shutdown_delay ="10s"
driver = "docker"
kill_timeout = "60s"
kill_signal = "SIGINT"
volume_mount {
volume = "stack_observability_grafana_volume"
destination = "/var/lib/grafana"
}
env {
GF_AUTH_OAUTH_AUTO_LOGIN= "true"
GF_AUTH_OAUTH_ALLOW_INSECURE_EMAIL_LOOKUP= "true"
GF_SERVER_DOMAIN = "grafana.cloud.private"
GF_PATHS_CONFIG = "/etc/grafana/grafana2.ini"
GF_PATHS_PLUGINS = "/var/lib/grafana2/plugins"
GF_SERVER_ROOT_URL = "https://grafana.cloud.private"
GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH = "contains(realm_access.roles[*], 'admin') && 'GrafanaAdmin' || contains(realm_access.roles[*], 'editor') && 'Editor' || 'Viewer'"
}
config {
image = "registry.cloud.private/stack/observability/grafana:${var.version_grafana_nomadder}"
labels = {
"com.github.logunifier.application.name" = "grafana"
"com.github.logunifier.application.version" = "${var.version_grafana_nomadder}"
"com.github.logunifier.application.org" = "${var.org}"
"com.github.logunifier.application.env" = "${var.env}"
"com.github.logunifier.application.pattern.key" = "logfmt"
}
ports = ["ui"]
}
resources {
cpu = 500
memory = 1024
memory_max = 4096
}
template {
destination = "${NOMAD_SECRETS_DIR}/env.vars"
env = true
change_mode = "restart"
data = <<EOF
{{ with nomadVar "nomad/jobs/observability" }}
GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET = {{.keycloak_secret_observability_grafana}}
{{ end }}
EOF
}
}
}
group "mimir"{
restart {
attempts = 5
interval = "10m"
delay = "15s"
mode = "delay"
}
volume "stack_observability_mimir_volume" {
type = "host"
source = "stack_observability_mimir_volume"
read_only = false
}
count = 1
network {
mode = "bridge"
port "api" {
static= 9009
to = 9009
}
}
service{
name ="mimir"
port= "api"
tags = [
"prometheus",
"prometheus:server_id=${NOMAD_ALLOC_NAME}",
"prometheus:version=${var.version_grafana_mimir}",
"prometheus:environment=${var.env}",
"prometheus:organisation=${var.org}",
]
check {
name = "health"
type = "http"
port ="api"
path="/ready"
interval = "10s"
timeout = "2s"
check_restart {
limit = 3
grace = "60s"
ignore_warnings = false
}
}
}
task "mimir"{
shutdown_delay ="10s"
driver = "docker"
kill_timeout = "60s"
kill_signal = "SIGINT"
volume_mount {
volume = "stack_observability_mimir_volume"
destination = "/data"
}
# env {
# JAEGER_ENDPOINT = "http://tempo-jaeger.service.consul:14268/api/traces?format=jaeger.thrift" # send traces to Tempo
# JAEGER_REPORTER_LOG_SPANS=true
# JAEGER_TRACEID_128BIT=true
# JAEGER_SAMPLER_TYPE="const"
# JAEGER_SAMPLER_PARAM="1"
# }
config {
image = "registry.cloud.private/grafana/mimir:${var.version_grafana_mimir}"
labels = {
"com.github.logunifier.application.name" = "mimir"
"com.github.logunifier.application.version" = "${var.version_grafana_mimir}"
"com.github.logunifier.application.org" = "${var.org}"
"com.github.logunifier.application.env" = "${var.env}"
"com.github.logunifier.application.pattern.key" = "logfmt"
}
ports = ["api"]
args = [
"-config.file","/config/mimir.yaml","-config.expand-env","true",
]
volumes = [
"local/mimir.yml:/config/mimir.yaml"
]
}
resources {
cpu = 2100
memory = 2048
memory_max = 32768
}
template {
change_mode = "restart"
right_delimiter = "++"
left_delimiter = "++"
data = <<EOF
# Test ++ env "NOMAD_ALLOC_NAME" ++
# Do not use this configuration in production.
# It is for demonstration purposes only.
# Run Mimir in single process mode, with all components running in 1 process.
target: all,alertmanager,overrides-exporter
# Disable tendency support.
multitenancy_enabled: false
server:
http_listen_port: ++env "NOMAD_HOST_PORT_api"++
log_level: info
# Configure the server to allow messages up to 100MB.
grpc_server_max_recv_msg_size: 104857600
grpc_server_max_send_msg_size: 104857600
grpc_server_max_concurrent_streams: 1000
blocks_storage:
backend: filesystem
bucket_store:
sync_dir: /data/tsdb-sync
#ignore_blocks_within: 10h # default 10h
filesystem:
dir: /data/blocks
tsdb:
dir: /data/tsdb
# Note that changing this requires changes to some other parameters like
# -querier.query-store-after,
# -querier.query-ingesters-within and
# -blocks-storage.bucket-store.ignore-blocks-within.
retention_period: 24h # default 24h
querier:
# query_ingesters_within: 13h # default 13h
#query_store_after: 12h #default 12h
ruler_storage:
backend: filesystem
filesystem:
dir: /data/rules
alertmanager_storage:
backend: filesystem
filesystem:
dir: /data/alarms
frontend:
grpc_client_config:
grpc_compression: snappy
frontend_worker:
grpc_client_config:
grpc_compression: snappy
ingester_client:
grpc_client_config:
grpc_compression: snappy
query_scheduler:
max_outstanding_requests_per_tenant: 10000
grpc_client_config:
grpc_compression: snappy
alertmanager:
data_dir: /data/alertmanager
retention: 24h
sharding_ring:
replication_factor: 1
alertmanager_client:
grpc_compression: snappy
ruler:
# Somehow the consul address does not works here
alertmanager_url: http://localhost:9009/alertmanager
query_frontend:
grpc_client_config:
grpc_compression: snappy
compactor:
# compaction_interval: 1h # default 1h
# deletion_delay: 12h # default 12h
max_closing_blocks_concurrency: 2
max_opening_blocks_concurrency: 4
symbols_flushers_concurrency: 4
data_dir: /data/compactor
sharding_ring:
kvstore:
store: memberlist
ingester:
ring:
replication_factor: 1
store_gateway:
sharding_ring:
replication_factor: 1
limits:
# Limit queries to 5 years. You can override this on a per-tenant basis.
max_total_query_length: 43680h
max_label_names_per_series: 42
# Allow ingestion of out-of-order samples up to 2 hours since the latest received sample for the series.
out_of_order_time_window: 1d
# delete old blocks from long-term storage.
# Delete from storage metrics data older than 1d.
compactor_blocks_retention_period: 1d
ingestion_rate: 100000
EOF
destination = "local/mimir.yml"
}
# template {
# change_mode = "restart"
# right_delimiter = "++"
# left_delimiter = "++"
# data = file(abspath("./configs/mimir/mimir.tpl"))
# destination = "local/mimir.yml"
# }
# template {
# change_mode = "restart"
# destination = "local/mimir.tpl"
# right_delimiter = "++"
# left_delimiter = "++"
# data = <<EOH
# ++ with nomadVar "nomad/jobs/observability" ++
# ++ .mimir_config ++
# ++ end ++
# EOH
# }
}
}
group "loki"{
restart {
attempts = 5
interval = "10m"
delay = "15s"
mode = "delay"
}
update {
max_parallel = 1
}
volume "stack_observability_loki_volume" {
type = "host"
source = "stack_observability_loki_volume"
read_only = false
}
count = 1
network {
mode = "bridge"
port "http" {
static = 3100
to = 3100
}
port "cli" {
static = 7946
to = 7946
}
port "grpc" {
static = 9005
to = 9095
}
}
service {
name ="loki"
port= "http"
tags = [
"prometheus",
"prometheus:service_id=${NOMAD_ALLOC_NAME}",
"prometheus:version=${var.version_grafana_loki}",
"prometheus:environment=${var.env}",
"prometheus:organisation=${var.org}",
]
check {
name = "health"
type = "http"
port ="http"
path="/ready"
interval = "10s"
timeout = "2s"
check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
task "loki"{
shutdown_delay ="10s"
driver = "docker"
kill_timeout = "60s"
kill_signal = "SIGINT"
volume_mount {
volume = "stack_observability_loki_volume"
destination = "/data"
}
# env {
# JAEGER_ENDPOINT = "http://tempo-jaeger.service.consul:14268/api/traces?format=jaeger.thrift" # send traces to Tempo
# JAEGER_REPORTER_LOG_SPANS=true
# JAEGER_TRACEID_128BIT=true
# JAEGER_SAMPLER_TYPE="const"
# JAEGER_SAMPLER_PARAM="1"
# }
config {
image = "registry.cloud.private/grafana/loki:${var.version_grafana_loki}"
labels = {
"com.github.logunifier.application.name" = "loki"
"com.github.logunifier.application.version" = "${var.version_grafana_loki}"
"com.github.logunifier.application.org" = "${var.org}"
"com.github.logunifier.application.env" = "${var.env}"
"com.github.logunifier.application.pattern.key" = "logfmt"
}
ports = ["http","cli","grpc"]
args = [
"-config.file","/config/loki.yaml","-config.expand-env","true","-print-config-stderr","true",
]
volumes = [
"local/loki.yaml:/config/loki.yaml"
]
}
resources {
cpu = 1000
memory = 1024
memory_max = 32768
}
template {
change_mode = "restart"
right_delimiter = "++"
left_delimiter = "++"
data = <<EOF
auth_enabled: false
server:
#default 3100
http_listen_port: 3100
#default 9005
#grpc_listen_port: 9005
# Max gRPC message size that can be received
# CLI flag: -server.grpc-max-recv-msg-size-bytes
#default 4194304 -> 4MB
grpc_server_max_recv_msg_size: 419430400
# Max gRPC message size that can be sent
# CLI flag: -server.grpc-max-send-msg-size-bytes
#default 4194304 -> 4MB
grpc_server_max_send_msg_size: 419430400
# Limit on the number of concurrent streams for gRPC calls (0 = unlimited)
# CLI flag: -server.grpc-max-concurrent-streams
grpc_server_max_concurrent_streams: 100
# Log only messages with the given severity or above. Supported values [debug,
# info, warn, error]
# CLI flag: -log.level
log_level: "info"
ingester:
shutdown_marker_path: /var/loki/shutdown-requested.txt
wal:
enabled: true
dir: /data/wal
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: memberlist
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
chunk_encoding: snappy
ruler:
evaluation_interval : 1m
poll_interval: 1m
storage:
type: local
local:
directory: /data/rules
rule_path: /data/scratch
++- range $index, $service := service "mimir" -++
++- if eq $index 0 ++
alertmanager_url: http://++$service.Name++.service.consul:++ $service.Port ++/alertmanager
++- end ++
++- end ++
ring:
kvstore:
store: memberlist
enable_api: true
enable_alertmanager_v2: true
compactor:
working_directory: /data/retention
delete_request_store: filesystem
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
schema_config:
configs:
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
storage_config:
tsdb_shipper:
active_index_directory: /data/index-tsdb
cache_location: /data/index-cache-tsdb
boltdb_shipper:
active_index_directory: /data/index
cache_location: /data/index-cache
filesystem:
directory: /data/chunks
index_queries_cache_config:
embedded_cache:
max_size_mb: 4096
enabled: true
querier:
multi_tenant_queries_enabled: false
max_concurrent: 4096
query_store_only: false
query_scheduler:
max_outstanding_requests_per_tenant: 10000
query_range:
cache_results: true
results_cache:
cache:
embedded_cache:
enabled: true
chunk_store_config:
chunk_cache_config:
embedded_cache:
max_size_mb: 4096
enabled: true
write_dedupe_cache_config:
embedded_cache:
max_size_mb: 4096
enabled: true
distributor:
ring:
kvstore:
store: memberlist
table_manager:
retention_deletes_enabled: true
retention_period: 24h
limits_config:
metric_aggregation_enabled: true
ingestion_rate_mb: 64
ingestion_burst_size_mb: 8
max_label_name_length: 4096
max_label_value_length: 8092
# Loki will reject any log lines that have already been processed and will not index them again
reject_old_samples: false
# 5y
reject_old_samples_max_age: 43800h
# The limit to length of chunk store queries. 0 to disable.
# 5y
max_query_length: 43800h
# Maximum number of log entries that will be returned for a query.
max_entries_limit_per_query: 20000
# Limit the maximum of unique series that is returned by a metric query.
max_query_series: 100000
# Maximum number of queries that will be scheduled in parallel by the frontend.
max_query_parallelism: 64
split_queries_by_interval: 24h
# Alter the log line timestamp during ingestion when the timestamp is the same as the
# previous entry for the same stream. When enabled, if a log line in a push request has
# the same timestamp as the previous line for the same stream, one nanosecond is added
# to the log line. This will preserve the received order of log lines with the exact
# same timestamp when they are queried, by slightly altering their stored timestamp.
# NOTE: This is imperfect, because Loki accepts out of order writes, and another push
# request for the same stream could contain duplicate timestamps to existing
# entries and they will not be incremented.
# CLI flag: -validation.increment-duplicate-timestamps
increment_duplicate_timestamp: true
#Log data retention for all
retention_period: 24h
max_query_lookback: 24h
# For enabling explore logs in grafana
# See https://grafana.com/docs/grafana-cloud/visualizations/simplified-exploration/logs/access/
allow_structured_metadata: true
volume_enabled: true
discover_log_levels: true
#defaults
# discover_service_name : [service app application name app_kubernetes_io_name container container_name k8s_container_name component workload job k8s_job_name]
# Comment this out for fine grained retention
# retention_stream:
# - selector: '{namespace="dev"}'
# priority: 1
# period: 24h
# Comment this out for having overrides
# per_tenant_override_config: /etc/overrides.yaml
# For enabling explore logs in grafana
# See https://grafana.com/docs/grafana-cloud/visualizations/simplified-exploration/logs/access/
pattern_ingester:
enabled: true
metric_aggregation:
loki_address: 127.0.0.1:3100
lifeSource: hashicorp/nomad