After node2 OOM incident, right-size memory across the cluster by setting requests=limits based on max_over_time(container_memory_working_set_bytes[7d]) with 1.3x headroom. Eliminates ~37Gi overcommit gap. Categories: - Safe equalization (50 containers): set req=lim where max7d well within target - Limit increases (8 containers): raise limits for services spiking above current - No Prometheus data (12 containers): conservatively set lim=req - Exception: nextcloud keeps req=256Mi/lim=8Gi due to Apache memory spikes Also increased dbaas namespace quota from 12Gi to 16Gi to accommodate mysql 4Gi limits across 3 replicas.
97 lines
1.9 KiB
HCL
97 lines
1.9 KiB
HCL
resource "kubernetes_deployment" "goflow2" {
|
|
metadata {
|
|
name = "goflow2"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
labels = {
|
|
app = "goflow2"
|
|
tier = var.tier
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
selector {
|
|
match_labels = {
|
|
app = "goflow2"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "goflow2"
|
|
}
|
|
}
|
|
spec {
|
|
container {
|
|
name = "goflow2"
|
|
image = "netsampler/goflow2:v2.2.1"
|
|
args = ["-listen", "netflow://:2055"]
|
|
|
|
port {
|
|
name = "netflow"
|
|
container_port = 2055
|
|
protocol = "UDP"
|
|
}
|
|
port {
|
|
name = "metrics"
|
|
container_port = 8080
|
|
protocol = "TCP"
|
|
}
|
|
|
|
resources {
|
|
requests = {
|
|
cpu = "50m"
|
|
memory = "128Mi"
|
|
}
|
|
limits = {
|
|
memory = "128Mi"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "goflow2" {
|
|
metadata {
|
|
name = "goflow2"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
labels = {
|
|
app = "goflow2"
|
|
}
|
|
}
|
|
spec {
|
|
selector = {
|
|
app = "goflow2"
|
|
}
|
|
port {
|
|
name = "metrics"
|
|
port = 8080
|
|
target_port = 8080
|
|
protocol = "TCP"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "goflow2-netflow" {
|
|
metadata {
|
|
name = "goflow2-netflow"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
labels = {
|
|
app = "goflow2"
|
|
}
|
|
}
|
|
spec {
|
|
type = "NodePort"
|
|
selector = {
|
|
app = "goflow2"
|
|
}
|
|
port {
|
|
name = "netflow"
|
|
port = 2055
|
|
target_port = 2055
|
|
protocol = "UDP"
|
|
node_port = 32055
|
|
}
|
|
}
|
|
}
|