Eject endpoints that keep failing
Use MeshCircuitBreaker outlierDetection to remove an endpoint from the load balancing pool after consecutive server-side errors, and return it after a delay.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshCircuitBreaker
metadata:
name: backend-outlier-detection
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: web
to:
- targetRef:
kind: MeshService
labels:
kuma.io/display-name: backend
default:
outlierDetection:
interval: 5s
baseEjectionTime: 30s
maxEjectionPercent: 20
detectors:
totalFailures:
consecutive: 10Copied!
type: MeshCircuitBreaker
name: backend-outlier-detection
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: web
to:
- targetRef:
kind: MeshService
labels:
kuma.io/display-name: backend
default:
outlierDetection:
interval: 5s
baseEjectionTime: 30s
maxEjectionPercent: 20
detectors:
totalFailures:
consecutive: 10Copied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_circuit_breaker" "backend_outlier_detection" {
provider = konnect-beta
type = "MeshCircuitBreaker"
name = "backend-outlier-detection"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "web"
}
}
to = [
{
target_ref = {
kind = "MeshService"
labels = {
"kuma.io/display-name" = "backend"
}
}
default = {
outlier_detection = {
interval = "5s"
base_ejection_time = "30s"
max_ejection_percent = 20
detectors = {
total_failures = {
consecutive = 10
}
}
}
}
}
]
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}
Copied!