User specific routing in Istio / Kuberentes

5/24/2018

I'm wondering if Istio is a good tool to support a particular routing situation, and if not (or even if it is), what other approaches are available.

  • I have two microservices, X and Y, with have some number of replicas for each.
  • X sends requests to Y.
  • X sends requests as a particular user, say "bob".
  • Some subset of the replicas of Y (not all!) can handle requests for the user "bob".
  • The subset of Y that can handle requests for "bob" is not static but changes over-time depending on some state stored at a replica that is ephemeral.

So when X sends requests, it must determine for the user it is sending the request ("bob"), which subset of Y can that particular request be sent to?

In Istio, there are examples of a routing rule that is associated with a user by looking at the HTTP headers. For the sever side, Y, would I simply have code in Y that calls the k8s API to add and remove labels against the replicas Pod?

e.g.,

Service-Y.Pod-1.Labels = {
  "user-bob": "true",
  "user-jane": "true",
  ...
}

Unclear how well labels handle this, or if this kind of routing should be lifted up to the application layer rather than trying to encode it in a largely transparent service mesh layer.

-- David Terei
grpc
istio
kubernetes
routing

1 Answer

5/24/2018

You have the open API from K8s. You can make some code which will add a label to pods and then route this traffic to your pods.

-- Nick Rak
Source: StackOverflow