Probe a destination over HTTP
Use MeshHealthCheck to probe an HTTP path on a destination and treat only the given response statuses as healthy.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshHealthCheck
metadata:
name: web-to-backend
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:
interval: 10s
timeout: 2s
unhealthyThreshold: 3
healthyThreshold: 1
http:
path: "/health"
expectedStatuses:
- 200Copied!
type: MeshHealthCheck
name: web-to-backend
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: web
to:
- targetRef:
kind: MeshService
labels:
kuma.io/display-name: backend
default:
interval: 10s
timeout: 2s
unhealthyThreshold: 3
healthyThreshold: 1
http:
path: "/health"
expectedStatuses:
- 200Copied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_health_check" "web_to_backend" {
provider = konnect-beta
type = "MeshHealthCheck"
name = "web-to-backend"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "web"
}
}
to = [
{
target_ref = {
kind = "MeshService"
labels = {
"kuma.io/display-name" = "backend"
}
}
default = {
interval = "10s"
timeout = "2s"
unhealthy_threshold = 3
healthy_threshold = 1
http = {
path = "/health"
expected_statuses = [
200
]
}
}
}
]
}
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!