Compare commits
5 Commits
ci/lesavka
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f84adbf29 | ||
|
|
8e0e29b445 | ||
|
|
e4cf47491c | ||
|
|
6285cdb4d8 | ||
|
|
43b6639516 |
@ -251,6 +251,45 @@ source restrictions, TLS and service authentication. The communications pool
|
|||||||
retains `.4` through `.6`; its Local-policy services need a speaker on their
|
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.
|
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.
|
||||||
|
|
||||||
|
Jenkins also has an HTTP-only ingress with `jenkins-https-redirect` middleware.
|
||||||
|
It redirects `http://ci.bstein.dev/` to HTTPS, preserving paths and query strings.
|
||||||
|
The HTTPS ingress alone does not match plain HTTP: without the separate route,
|
||||||
|
typing the hostname can return Traefik's plain-text 404 even while HTTPS is healthy.
|
||||||
|
|
||||||
|
For a repeat report, check both `http://ci.bstein.dev/` and
|
||||||
|
`https://ci.bstein.dev/login`, compare `/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
|
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
|
peers or advertisements. Titan-05/06 are excluded from the speaker DaemonSet
|
||||||
until their recovery checks pass. Remove that explicit exclusion in
|
until their recovery checks pass. Remove that explicit exclusion in
|
||||||
|
|||||||
@ -40,12 +40,13 @@ items:
|
|||||||
- --metrics.prometheus.addEntryPointsLabels=true
|
- --metrics.prometheus.addEntryPointsLabels=true
|
||||||
- --metrics.prometheus.addRoutersLabels=true
|
- --metrics.prometheus.addRoutersLabels=true
|
||||||
- --metrics.prometheus.addServicesLabels=true
|
- --metrics.prometheus.addServicesLabels=true
|
||||||
- --entrypoints.web.transport.respondingTimeouts.readTimeout=0s
|
# Bound stalled reads and idle connections; allow five minutes for uploads.
|
||||||
|
- --entrypoints.web.transport.respondingTimeouts.readTimeout=300s
|
||||||
- --entrypoints.web.transport.respondingTimeouts.writeTimeout=0s
|
- --entrypoints.web.transport.respondingTimeouts.writeTimeout=0s
|
||||||
- --entrypoints.web.transport.respondingTimeouts.idleTimeout=0s
|
- --entrypoints.web.transport.respondingTimeouts.idleTimeout=180s
|
||||||
- --entrypoints.websecure.transport.respondingTimeouts.readTimeout=0s
|
- --entrypoints.websecure.transport.respondingTimeouts.readTimeout=300s
|
||||||
- --entrypoints.websecure.transport.respondingTimeouts.writeTimeout=0s
|
- --entrypoints.websecure.transport.respondingTimeouts.writeTimeout=0s
|
||||||
- --entrypoints.websecure.transport.respondingTimeouts.idleTimeout=0s
|
- --entrypoints.websecure.transport.respondingTimeouts.idleTimeout=180s
|
||||||
- --ping=true
|
- --ping=true
|
||||||
- --ping.entrypoint=health
|
- --ping.entrypoint=health
|
||||||
- --entrypoints.health.address=:8082
|
- --entrypoints.health.address=:8082
|
||||||
@ -58,13 +59,33 @@ items:
|
|||||||
image: traefik:v3.3.3@sha256:19884a9d0b922b321c9cff54cbfe43f3169893041b8dd4ea6100677afaddce46
|
image: traefik:v3.3.3@sha256:19884a9d0b922b321c9cff54cbfe43f3169893041b8dd4ea6100677afaddce46
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
name: traefik
|
name: traefik
|
||||||
|
env:
|
||||||
|
# Leave room for socket buffers and memory outside the Go heap.
|
||||||
|
- name: GOMEMLIMIT
|
||||||
|
value: 768MiB
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 250m
|
||||||
memory: 256Mi
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
memory: 512Mi
|
||||||
|
limits:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 1Gi
|
||||||
|
startupProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /ping
|
||||||
|
port: health
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 30
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /ping
|
||||||
|
port: health
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 6
|
||||||
|
# A wedged process cannot use the normal five-minute drain window.
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /ping
|
path: /ping
|
||||||
|
|||||||
@ -9,4 +9,4 @@ spec:
|
|||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 25Gi
|
storage: 40Gi
|
||||||
|
|||||||
23
services/jenkins/ingress-http.yaml
Normal file
23
services/jenkins/ingress-http.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# services/jenkins/ingress-http.yaml
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: jenkins-http
|
||||||
|
namespace: jenkins
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: web
|
||||||
|
traefik.ingress.kubernetes.io/router.tls: "false"
|
||||||
|
traefik.ingress.kubernetes.io/router.middlewares: jenkins-jenkins-https-redirect@kubernetescrd
|
||||||
|
spec:
|
||||||
|
ingressClassName: traefik
|
||||||
|
rules:
|
||||||
|
- host: ci.bstein.dev
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: jenkins
|
||||||
|
port:
|
||||||
|
name: http
|
||||||
@ -17,6 +17,8 @@ resources:
|
|||||||
- vault-sync-deployment.yaml
|
- vault-sync-deployment.yaml
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
|
- middleware-https-redirect.yaml
|
||||||
|
- ingress-http.yaml
|
||||||
- ingress.yaml
|
- ingress.yaml
|
||||||
- lesavka-userns-probe.yaml
|
- lesavka-userns-probe.yaml
|
||||||
- lesavka-kvm-device-plugin.yaml
|
- lesavka-kvm-device-plugin.yaml
|
||||||
|
|||||||
10
services/jenkins/middleware-https-redirect.yaml
Normal file
10
services/jenkins/middleware-https-redirect.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# services/jenkins/middleware-https-redirect.yaml
|
||||||
|
apiVersion: traefik.io/v1alpha1
|
||||||
|
kind: Middleware
|
||||||
|
metadata:
|
||||||
|
name: jenkins-https-redirect
|
||||||
|
namespace: jenkins
|
||||||
|
spec:
|
||||||
|
redirectScheme:
|
||||||
|
scheme: https
|
||||||
|
permanent: true
|
||||||
56
services/jenkins/validation/lesavka-worker-source.groovy
Normal file
56
services/jenkins/validation/lesavka-worker-source.groovy
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Read public worker definitions through the installed Pipeline step. Supply two
|
||||||
|
// reviewed commits with different payload hashes and an existing software run.
|
||||||
|
// No job is created, saved, queued or changed; credentials stay inside GitSCMSource.
|
||||||
|
import groovy.json.JsonOutput
|
||||||
|
import hudson.model.Run
|
||||||
|
import hudson.model.TaskListener
|
||||||
|
import jenkins.model.Jenkins
|
||||||
|
import jenkins.plugins.git.GitSCMSource
|
||||||
|
import org.jenkinsci.plugins.workflow.steps.StepContext
|
||||||
|
import org.jenkinsci.plugins.workflow.steps.scm.ReadScmFileStep
|
||||||
|
import java.security.MessageDigest
|
||||||
|
|
||||||
|
def job = Jenkins.get().getItemByFullName('lesavka-software-tests')
|
||||||
|
def build = job.getBuildByNumber(binding.getVariable('existingBuild') as int)
|
||||||
|
assert build != null && !build.building
|
||||||
|
def before = job.configFile.asString()
|
||||||
|
def context = [get: { Class type ->
|
||||||
|
if (type == Run) { return build }
|
||||||
|
if (type == TaskListener) { return TaskListener.NULL }
|
||||||
|
throw new IllegalStateException('Unexpected step context: ' + type.name)
|
||||||
|
}] as StepContext
|
||||||
|
def source = new GitSCMSource('https://scm.bstein.dev/bstein/lesavka.git')
|
||||||
|
source.credentialsId = 'gitea-pat'
|
||||||
|
def read = { String revision, String path ->
|
||||||
|
def execution = new ReadScmFileStep(source, revision, path).start(context)
|
||||||
|
def method = execution.class.getDeclaredMethod('run')
|
||||||
|
method.accessible = true
|
||||||
|
method.invoke(execution)
|
||||||
|
}
|
||||||
|
def digest = { String value ->
|
||||||
|
MessageDigest.getInstance('SHA-256').digest(value.getBytes('UTF-8')).encodeHex().toString()
|
||||||
|
}
|
||||||
|
def expected = binding.getVariable('expectedPayloads')
|
||||||
|
assert expected.size() == 2 && expected.values().toSet().size() == 2
|
||||||
|
def checks = []
|
||||||
|
expected.each { revision, sha256 ->
|
||||||
|
assert revision ==~ /[0-9a-f]{40}/
|
||||||
|
assert sha256 ==~ /[0-9a-f]{64}/
|
||||||
|
assert digest(read(revision, 'docker/software-test-pod.yaml')) == sha256
|
||||||
|
checks << 'exact_worker_payload_' + revision
|
||||||
|
}
|
||||||
|
boolean missingRefused = false
|
||||||
|
try {
|
||||||
|
read('0' * 40, 'docker/software-test-pod.yaml')
|
||||||
|
} catch (java.lang.reflect.InvocationTargetException failure) {
|
||||||
|
assert failure.cause instanceof hudson.AbortException
|
||||||
|
assert failure.cause.message == 'No such revision'
|
||||||
|
missingRefused = true
|
||||||
|
}
|
||||||
|
assert missingRefused
|
||||||
|
checks << 'missing_revision_refused_without_fallback'
|
||||||
|
assert job.configFile.asString() == before
|
||||||
|
checks << 'installed_job_unchanged'
|
||||||
|
println(JsonOutput.toJson([status: 'passed', checks: checks,
|
||||||
|
plugin: Jenkins.get().pluginManager.getPlugin('workflow-scm-step').version]))
|
||||||
|
return null
|
||||||
@ -5,6 +5,66 @@ metadata:
|
|||||||
name: vmalert-atlas-availability-rules
|
name: vmalert-atlas-availability-rules
|
||||||
namespace: monitoring
|
namespace: monitoring
|
||||||
data:
|
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: |
|
hermes-triage.yaml: |
|
||||||
groups:
|
groups:
|
||||||
- name: hermes.triage
|
- name: hermes.triage
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user