Two real issues found while triaging HomeAssistantCriticalSensorUnavailable
alerts and the prometheus + technitium PVC Terminating-but-in-use
state from the earlier session.
1. idrac-redfish-exporter + snmp-exporter ingresses: auth=required →
auth=none. HA Sofia REST sensors scrape these endpoints
programmatically; with Authentik forward-auth in front, every
request got a 302 to authentik.viktorbarzin.me and the REST
sensors parsed the HTML login page instead of metrics — leaving
the R730, UPS, and ~20 other sensors permanently unavailable.
The allow_local_access_only IP allowlist (192.168.0.0/16 +
10.0.0.0/8) already gates external access, so authentik on top
was breaking machine-to-machine traffic for no security gain.
2. prometheus_server_pvc + technitium primary_config_encrypted:
add lifecycle.ignore_changes = [spec[0].resources[0].requests].
The autoresizer expands these PVCs; PVCs can't shrink. Without
the ignore, every TF apply tried to revert the live size back
to the TF spec value, hit K8s's shrink-forbidden rule, and
force-replaced the PVC. Because the pod still mounted it, the
PVC went into Terminating-but-protected limbo — fine until a
pod restart would have orphaned the volume. Root cause of the
2026-05-10 PVC Terminating incident.
Bonus: prometheus_server_pvc threshold was the inverted "90%" (the
same bug the bulk fecfa211 sweep fixed elsewhere; my regex only
matched "80%" so this one slipped through). Now "10%".
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
142 lines
3.9 KiB
HCL
142 lines
3.9 KiB
HCL
|
|
resource "kubernetes_config_map" "redfish-config" {
|
|
metadata {
|
|
name = "redfish-exporter-config"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
|
|
annotations = {
|
|
"reloader.stakater.com/match" = "true"
|
|
}
|
|
}
|
|
data = {
|
|
"config.yml" = <<-EOF
|
|
address: 0.0.0.0
|
|
port: 9610
|
|
hosts:
|
|
${var.idrac_host}:
|
|
username: ${var.idrac_username}
|
|
password: ${var.idrac_password}
|
|
default:
|
|
username: root
|
|
password: calvin
|
|
metrics:
|
|
all: true
|
|
# system: true
|
|
# sensors: true
|
|
# power: true
|
|
# sel: false # Disable SEL - often slow
|
|
# storage: true # Disable storage - slowest endpoint
|
|
# memory: true
|
|
# network: false # Disable network adapters
|
|
# firmware: false # Don't need this frequently
|
|
EOF
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_deployment" "idrac-redfish" {
|
|
metadata {
|
|
name = "idrac-redfish-exporter"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
labels = {
|
|
app = "idrac-redfish-exporter"
|
|
tier = var.tier
|
|
}
|
|
annotations = {
|
|
"reloader.stakater.com/search" = "true"
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
selector {
|
|
match_labels = {
|
|
app = "idrac-redfish-exporter"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "idrac-redfish-exporter"
|
|
}
|
|
}
|
|
spec {
|
|
priority_class_name = "tier-1-cluster"
|
|
container {
|
|
# https://github.com/mrlhansen/idrac_exporter?tab=readme-ov-file
|
|
# Patched v2.4.1 - restored missing idrac_power_supply_input_voltage metric
|
|
# See: https://github.com/mrlhansen/idrac_exporter/issues/176
|
|
image = "viktorbarzin/idrac-redfish-exporter:2.4.1-voltage-fix"
|
|
name = "redfish-exporter"
|
|
port {
|
|
container_port = 9610
|
|
}
|
|
|
|
volume_mount {
|
|
name = "redfish-exporter-config"
|
|
mount_path = "/etc/prometheus/idrac.yml"
|
|
sub_path = "config.yml"
|
|
}
|
|
}
|
|
volume {
|
|
name = "redfish-exporter-config"
|
|
config_map {
|
|
name = "redfish-exporter-config"
|
|
}
|
|
}
|
|
dns_config {
|
|
option {
|
|
name = "ndots"
|
|
value = "2"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
lifecycle {
|
|
# KYVERNO_LIFECYCLE_V1: Kyverno admission webhook mutates dns_config with ndots=2
|
|
ignore_changes = [spec[0].template[0].spec[0].dns_config]
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "idrac-redfish-exporter" {
|
|
metadata {
|
|
name = "idrac-redfish-exporter"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
labels = {
|
|
"app" = "idrac-redfish-exporter"
|
|
}
|
|
# annotations = {
|
|
# "prometheus.io/scrape" = "true"
|
|
# "prometheus.io/path" = "/metrics"
|
|
# "prometheus.io/port" = "9090"
|
|
# }
|
|
}
|
|
|
|
spec {
|
|
selector = {
|
|
"app" = "idrac-redfish-exporter"
|
|
}
|
|
port {
|
|
name = "http"
|
|
port = "9090"
|
|
target_port = "9610"
|
|
}
|
|
}
|
|
}
|
|
|
|
module "idrac-redfish-exporter-ingress" {
|
|
source = "../../../../modules/kubernetes/ingress_factory"
|
|
# Auth disabled: HA Sofia + Prometheus scrape this endpoint
|
|
# programmatically (no browser, no SSO cookie). The
|
|
# allow_local_access_only middleware (192.168.0.0/16 + 10.0.0.0/8)
|
|
# already gates external access, so layering Authentik on top only
|
|
# breaks the REST sensor in HA Sofia (it gets a 302 to authentik.viktorbarzin.me
|
|
# and parses HTML instead of metrics).
|
|
auth = "none"
|
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
|
name = "idrac-redfish-exporter"
|
|
root_domain = "viktorbarzin.lan"
|
|
tls_secret_name = var.tls_secret_name
|
|
allow_local_access_only = true
|
|
ssl_redirect = false
|
|
port = 9090
|
|
}
|