Fail over within a region before leaving it
Order cross-zone failover so a client tries the other zones in its own region first, and only then a zone in another region.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshLoadBalancingStrategy
metadata:
name: backend-regional-failover
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
to:
- targetRef:
kind: MeshMultiZoneService
labels:
kuma.io/display-name: backend
default:
localityAwareness:
crossZone:
failover:
- from:
zones:
- us-1
- us-2
- us-3
to:
type: Only
zones:
- us-1
- us-2
- us-3
- from:
zones:
- eu-1
- eu-2
- eu-3
to:
type: Only
zones:
- eu-1
- eu-2
- eu-3
- to:
type: Only
zones:
- us-4
failoverThreshold:
percentage: 50Copied!
type: MeshLoadBalancingStrategy
name: backend-regional-failover
mesh: default
spec:
to:
- targetRef:
kind: MeshMultiZoneService
labels:
kuma.io/display-name: backend
default:
localityAwareness:
crossZone:
failover:
- from:
zones:
- us-1
- us-2
- us-3
to:
type: Only
zones:
- us-1
- us-2
- us-3
- from:
zones:
- eu-1
- eu-2
- eu-3
to:
type: Only
zones:
- eu-1
- eu-2
- eu-3
- to:
type: Only
zones:
- us-4
failoverThreshold:
percentage: 50Copied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_load_balancing_strategy" "backend_regional_failover" {
provider = konnect-beta
type = "MeshLoadBalancingStrategy"
name = "backend-regional-failover"
spec = {
to = [
{
target_ref = {
kind = "MeshMultiZoneService"
labels = {
"kuma.io/display-name" = "backend"
}
}
default = {
locality_awareness = {
cross_zone = {
failover = [
{
from = {
zones = [
"us-1",
"us-2",
"us-3"
]
}
to = {
type = "Only"
zones = [
"us-1",
"us-2",
"us-3"
]
}
},
{
from = {
zones = [
"eu-1",
"eu-2",
"eu-3"
]
}
to = {
type = "Only"
zones = [
"eu-1",
"eu-2",
"eu-3"
]
}
},
{
to = {
type = "Only"
zones = [
"us-4"
]
}
}
]
failover_threshold = {
percentage = { integer = 50 }
}
}
}
}
}
]
}
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!