Grpc + Http Dynamic Routing


#1

Hey All -

I’m having a hard time working on dynamic routing for both HTTP / GRPC. l5d-dtab works great on HTTP, but unfortunately, it’s not working on grpc for me and seems that the feature is not implemented yet.

Mainly the goal is to have versioned services for both grpc and http.

{servicename}.domain.com => service-version POD.

Best case story is if I can set some sort of header in gRPC and HTTP where it translates:

  1. The service name => pod name
  2. header -> version=X for label

I found this config for mapping gRPC services, but could use help on label selection example for both HTTP and gRPC.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: map-service
annotations:
  kubernetes.io/ingress.class: "linkerd"
spec:
backend:
  serviceName: map-service
  servicePort: 8080

#2

@Disturbing, just for my own understanding with this issue, are you looking create two seperate ingresses (one for GRPC and one for HTTP)? If you are then setting the label to anything you want should suffice. In your linkerd config, you could then set up two ingress routers and use the ingressClassAnnotation field to match each router with the respective ingress. Does that sound like something that could work?


#3

I can’t figure out how to have LinkerD route gRPC Versioning via metadata.

Simply would want to set a header like in this example:

https://buoyant.io/2017/01/06/a-service-mesh-for-kubernetes-part-vi-staging-microservices-without-the-tears/

or
https://buoyant.io/2016/11/18/a-service-mesh-for-kubernetes-part-v-dogfood-environments-ingress-and-edge-routing/

using the dtab override header. It works for HTTP, but not for gRPC.


#4

@Disturbing, unfortunately labelSelector's only select on Service objects, not pods.

I think the most straightforward way to solve this issue is to create two separate Service objects in Kubernetes, and route to them by name as I assume you are already doing.

There’s an open issue to make labelSelector's filter on pods, allowing you to do more interesting things like curl v2.myservice: