Reputation: 1
I'm trying to implement autoscaling for a job in HashiCorp Nomad using the autoscaler feature. Specifically, I want to scale based on memory usage thresholds. I have a Nomad job configuration file (job.hcl) and I'm looking to integrate the autoscaling policy to dynamically adjust the number of instances based on memory utilization.
job "react-frontend" {
datacenters = ["dc1"]
type = "service"
group "demo" {
count = 1
scaling {
enabled = true
min = 1
max = 3
policy {
check "high-memory-usage" {
group = "memory-usage"
strategy "threshold" {
upper_bound = 20
lower_bound = 10
delta = 1
}
}
}
}
network {
port "http" {
to = 3000
}
}
service {
name = "react-frontend"
port = "http"
check {
type = "http"
path = "/"
interval = "2s"
timeout = "2s"
}
}
task "react-frontend" {
driver = "docker"
resources {
cpu = 100
memory = 1024
}
config {
image = <my-image>
ports = ["http"]
}
}
}
}
However, I'm uncertain if this setup is correct or if there are additional configurations or best practices I should follow when using the Nomad Autoscaler.
Could someone provide guidance on how to correctly implement and validate Nomad Autoscaler policies for job scaling based on resource usage thresholds?
Thank you!
Upvotes: 0
Views: 166