seldon-core icon indicating copy to clipboard operation
seldon-core copied to clipboard

Is it possible to disable creation of service for each PU container in the inference graph

Open zyxue opened this issue 2 years ago • 6 comments

I have an inference graph like

    graph:
      name: output-transformer
      type: OUTPUT_TRANSFORMER
      endpoint:
        type: GRPC
      children:
        - name: input-transformer
          type: TRANSFORMER
          endpoint:
            type: GRPC
          children:
            - name: model
              type: MODEL
              endpoint:
                type: GRPC

it looks seldon will create a service for each PU.

But I notice not all PU services can find the pod because the pod selector in the service definition are like

...
selector:
  seldon-app-svc: myapp-myapp-myapp-output-transformer
...
selector:
  seldon-app-svc: myapp-myapp-myapp-input-transformer
...
selector:
  seldon-app-svc: myapp-myapp-myapp-model
...

But in the pod created, the labels only include

seldon-app-svc: myapp-myapp-myapp-output-transformer

as the output-transformer is the root (I guess). So only the output transformer container service works. The other two PU service won't find the running pod for them.

Questions:

  1. is this a bug?
  2. why is it necessary to create a service for each PU as only the seldon executor (aka. engine, orchestrator) container is exposed to external applications? Is it possible to disable the creation of the PU services, they appear to create confusion in k get svc.

zyxue avatar Apr 05 '22 16:04 zyxue

Are you saying it does not work as expected? A svc is created for each node in case you decide to place them on separate Deployments so we can ensure that they are reachable via a SVC.

ukclivecox avatar Apr 07 '22 07:04 ukclivecox

The code adding these labels is https://github.com/SeldonIO/seldon-core/blob/9e8d5e8f9d930f7c3eaef7494845c0c2c4aad4ad/operator/controllers/seldondeployment_controller.go#L747-L749

ukclivecox avatar Apr 07 '22 07:04 ukclivecox

deploy.Spec.Selector.MatchLabels[containerServiceKey] = containerServiceValue explains how the seldon-app-svc key under selector is set for the services.

but they don't work because the pod is only labeled with myapp-myapp-myapp-output-transformer.

Are you saying it does not work as expected?

No, they don't because all PUs/containers are in the same pod with just one seldon-app-svc label, but the container svcs are looking for different pods.

A svc is created for each node in case you decide to place them on separate Deployments so we can ensure that they are reachable via a SVC.

I see. It may make sense to have a svc for each PU/container if they're in different pods.

zyxue avatar Apr 07 '22 22:04 zyxue

Whether they are placed in different pods is up to you and dependent on how you place the containers in the componentSpecs array which is an array of PodSpecs.

ukclivecox avatar Apr 08 '22 06:04 ukclivecox

In my case, i prefer to put them in the same pod for lower latency.

zyxue avatar Apr 08 '22 13:04 zyxue

I have validated there is an issue with the top level services when they are all in the same pod. This won't affect inference if the orchestrator is in same pod which is usually the case as it will be calling on localhost. However, I agree the SVCs need to be fixed for external pod access to each node.

ukclivecox avatar Apr 08 '22 13:04 ukclivecox