diff --git a/agent/docker/deepflow-agent-ds.yaml b/agent/docker/deepflow-agent-ds.yaml index a1cdccc7fc5..5ca874b9912 100644 --- a/agent/docker/deepflow-agent-ds.yaml +++ b/agent/docker/deepflow-agent-ds.yaml @@ -24,6 +24,22 @@ spec: imagePullPolicy: Never securityContext: privileged: true + readinessProbe: + httpGet: + path: /v1/ready/ + port: 38086 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /v1/health/ + port: 38086 + initialDelaySeconds: 15 + periodSeconds: 20 + timeoutSeconds: 5 + failureThreshold: 3 volumeMounts: - name: sys-kernel-debug mountPath: /sys/kernel/debug diff --git a/agent/src/integration_collector.rs b/agent/src/integration_collector.rs index be9d83f1ed8..ede10e6f476 100644 --- a/agent/src/integration_collector.rs +++ b/agent/src/integration_collector.rs @@ -637,6 +637,18 @@ async fn handler( .body(doc_bytes.as_slice().into()) .unwrap()) } + // Health check endpoint for liveness probe + (&Method::GET, "/v1/health/") => Ok(Response::builder() + .status(StatusCode::OK) + .header("Content-Type", "application/json") + .body(r#"{"status":"healthy"}"#.into()) + .unwrap()), + // Readiness probe endpoint - returns 200 when the server is ready to accept traffic + (&Method::GET, "/v1/ready/") => Ok(Response::builder() + .status(StatusCode::OK) + .header("Content-Type", "application/json") + .body(r#"{"status":"ready"}"#.into()) + .unwrap()), // OpenTelemetry trace integration (&Method::POST, "/api/v1/otel/trace") => { if external_trace_integration_disabled {