Add a cluster and route to it
Add a static cluster, then add a virtual host that sends traffic to it on the route configuration of an existing HTTP outbound. Outbound route configurations are named by the KRI of the destination port, so copy the exact name from the proxy config dump.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshProxyPatch
metadata:
name: backend-extra-cluster
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
appendModifications:
- cluster:
operation: Add
value: |
name: extra-cluster
connectTimeout: 5s
type: STATIC
loadAssignment:
clusterName: extra-cluster
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 127.0.0.1
portValue: 8080
- virtualHost:
operation: Add
match:
routeConfigurationName: kri_msvc_default_zone-1_kong-mesh-demo_orders_http
value: |
name: extra
domains:
- extra.local
routes:
- match:
prefix: /
route:
cluster: extra-clusterCopied!
type: MeshProxyPatch
name: backend-extra-cluster
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
appendModifications:
- cluster:
operation: Add
value: |
name: extra-cluster
connectTimeout: 5s
type: STATIC
loadAssignment:
clusterName: extra-cluster
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 127.0.0.1
portValue: 8080
- virtualHost:
operation: Add
match:
routeConfigurationName: kri_msvc_default_zone-1_kong-mesh-demo_orders_http
value: |
name: extra
domains:
- extra.local
routes:
- match:
prefix: /
route:
cluster: extra-clusterCopied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_proxy_patch" "backend_extra_cluster" {
provider = konnect-beta
type = "MeshProxyPatch"
name = "backend-extra-cluster"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "backend"
}
}
default = {
append_modifications = [
{
cluster = {
operation = "Add"
value = <<-EOT
name: extra-cluster
connectTimeout: 5s
type: STATIC
loadAssignment:
clusterName: extra-cluster
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 127.0.0.1
portValue: 8080
EOT
}
},
{
virtual_host = {
operation = "Add"
match = {
route_configuration_name = "kri_msvc_default_zone-1_kong-mesh-demo_orders_http"
}
value = <<-EOT
name: extra
domains:
- extra.local
routes:
- match:
prefix: /
route:
cluster: extra-cluster
EOT
}
}
]
}
}
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!