From 8e0e29b4458f2aa8674aab977d25fb0b16ce4f2a Mon Sep 17 00:00:00 2001 From: jenkins Date: Sat, 28 Nov 2026 22:50:31 -0600 Subject: [PATCH] monitoring: detect ingress capacity loss and Jenkins outages --- docs/CLUSTER_OPERATIONS.md | 33 ++++++++++ .../vmalert-atlas-availability.yaml | 60 +++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/docs/CLUSTER_OPERATIONS.md b/docs/CLUSTER_OPERATIONS.md index 6c76cc49..c034df5b 100644 --- a/docs/CLUSTER_OPERATIONS.md +++ b/docs/CLUSTER_OPERATIONS.md @@ -251,6 +251,39 @@ source restrictions, TLS and service authentication. The communications pool retains `.4` through `.6`; its Local-policy services need a speaker on their actual endpoint node. Do not restrict all pools to ingress nodes indiscriminately. +The November 28 Jenkins incident was an ingress failure: Jenkins answered +`/login` locally, its PVC was only 13% full, and the controller had no restarts. +Both Traefik replicas had `OOMKilled` terminations at their former 512 MiB limit. +One stayed unready for roughly eleven hours without a liveness probe. The other +held over 6,000 HTTPS connections; all request-read and idle timeouts were disabled. +Metrics recorded periods with zero available ingress replicas. + +Traefik now bounds request reads to 300 seconds and idle keep-alive connections +to 180 seconds. The read deadline includes the entire upload body: clients with +uploads longer than five minutes must use chunks or a separately configured +entrypoint. Keep response writes unlimited for streaming. Do not globally remove +read/idle deadlines to accommodate an individual application. See the +[Traefik timeout definitions](https://doc.traefik.io/traefik/v3.3/routing/entrypoints/#respondingtimeouts). +The 1 GiB container limit has a 768 MiB Go soft limit, leaving headroom for +non-runtime memory; the [Go memory limit](https://go.dev/doc/gc-guide#Memory_limit) +does not replace connection bounds or the container limit. + +Startup and liveness probes use the same internal `/ping` endpoint as readiness. +Six failed ten-second liveness checks restart an unresponsive container with a +30-second termination grace, while normal rollouts retain the five-minute drain +window and keep at least one ready replica. The `atlas.ingress.health` rule group +evaluates every minute and detects total ingress loss, lost redundancy, recent +OOM restarts, sustained memory pressure and Jenkins controller unavailability. +These rules reach Alertmanager's existing silent default receiver; email routing +remains limited to the previously configured Hermes alerts. + +For a repeat report, compare `https://ci.bstein.dev/login` with `/login` inside +the Jenkins container, then check the SSO redirect at +`https://ci.bstein.dev/securityRealm/commenceLogin`. Inspect Traefik pod termination +reasons, `/ping`, `traefik_open_connections` and memory before restarting Jenkins. +Apply recovery configuration through Git and reconcile `traefik`; verify two ready +replicas and a working public login before declaring recovery. + MetalLB uses native L2 mode, without unused FRR/BGP sidecars. There are no BGP peers or advertisements. Titan-05/06 are excluded from the speaker DaemonSet until their recovery checks pass. Remove that explicit exclusion in diff --git a/services/monitoring/vmalert-atlas-availability.yaml b/services/monitoring/vmalert-atlas-availability.yaml index b2e6bec9..887e87f7 100644 --- a/services/monitoring/vmalert-atlas-availability.yaml +++ b/services/monitoring/vmalert-atlas-availability.yaml @@ -5,6 +5,66 @@ metadata: name: vmalert-atlas-availability-rules namespace: monitoring data: + ingress-health.yaml: | + groups: + - name: atlas.ingress.health + interval: 1m + # Availability must use fresh samples, not the rollups' one-hour lookback. + params: + step: [2m] + rules: + - alert: AtlasIngressUnavailable + expr: (max(kube_deployment_status_replicas_available{namespace="traefik",deployment="traefik"}) or vector(0)) == 0 + for: 1m + labels: + severity: critical + service: atlas-ingress + annotations: + summary: "Atlas ingress has no available replicas" + description: "Public services including ci.bstein.dev may be unreachable. Check Traefik readiness, termination reasons and kube-state-metrics freshness before restarting applications." + - alert: AtlasIngressRedundancyLost + expr: | + (max(kube_deployment_status_replicas_available{namespace="traefik",deployment="traefik"}) < 2) + and (max(kube_deployment_status_replicas_available{namespace="traefik",deployment="traefik"}) > 0) + for: 5m + labels: + severity: warning + service: atlas-ingress + annotations: + summary: "Atlas ingress has lost its second replica" + description: "Only one Traefik replica has been available for five minutes. Inspect rollout events, /ping and memory pressure before the remaining replica fails." + - alert: AtlasIngressOOMKilled + expr: | + (max by (namespace, pod, container) (kube_pod_container_status_last_terminated_reason{namespace="traefik",container="traefik",reason="OOMKilled"}) == 1) + and on (namespace, pod, container) + (max by (namespace, pod, container) (increase(kube_pod_container_status_restarts_total{namespace="traefik",container="traefik"}[15m])) > 0) + labels: + severity: warning + service: atlas-ingress + annotations: + summary: "Traefik was killed by its memory limit" + description: "{{ $labels.pod }} restarted after an OOM kill. Inspect open connections, request timeouts and Go memory usage; increasing the limit alone does not bound retained connections." + - alert: AtlasIngressMemoryPressure + expr: | + max by (namespace, pod, container) (container_memory_working_set_bytes{namespace="traefik",container="traefik"}) + / on (namespace, pod, container) + max by (namespace, pod, container) (kube_pod_container_resource_limits{namespace="traefik",container="traefik",resource="memory"}) > 0.85 + for: 5m + labels: + severity: warning + service: atlas-ingress + annotations: + summary: "Traefik memory has exceeded 85% of its limit" + description: "{{ $labels.pod }} is approaching its memory limit. Check connection counts and timeout settings before ingress becomes unavailable." + - alert: JenkinsControllerUnavailable + expr: (max(kube_deployment_status_replicas_available{namespace="jenkins",deployment="jenkins"}) or vector(0)) == 0 + for: 2m + labels: + severity: critical + service: jenkins + annotations: + summary: "Jenkins has no available controller" + description: "Check Jenkins pod events, /login, its PVC and Vault initialization. If the controller is healthy, check Traefik and SSO separately. Missing deployment telemetry also triggers this alert." hermes-triage.yaml: | groups: - name: hermes.triage