Kong Mesh also supports routing between services with HTTPRoute in conformance with the GAMMA specifications.
GAMMA is a Gateway API project focused on mesh implementations of the Gateway API and extending the Gateway API resources to mesh use cases.
The key feature of HTTPRoute for mesh routing is specifying a Kubernetes Service as the parentRef, as opposed to a Gateway.
All requests to this Service are then filtered and routed as specified in the HTTPRoute.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: canary-demo-app
namespace: kuma-demo
spec:
parentRefs:
- name: demo-app
port: 5000
kind: Service
rules:
- backendRefs:
- name: demo-app-v1
port: 5000
- name: demo-app-v2
port: 5000
The namespace of the HTTPRoute is key. If the route’s namespace and the parentRef’s namespace are identical, Kong Mesh applies the route to requests from all workloads.
If the route’s namespace differs from its parentRef’s namespace, the HTTPRoute applies only to requests from workloads in the route’s namespace.
Remember to tag your Service ports with appProtocol: http to use them in an HTTPRoute.
Because of how Kong Mesh currently maps resources, the combination of the HTTPRoute name and namespace and the parent Service name and namespace must be no more than 249 characters.