<p>I noticed whenever I deployed one model, there are two services, e.g.</p>
<pre><code>kubectl get service -n model-namespace 
NAME                            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)             AGE
iris-model-default              ClusterIP   10.96.82.232   &lt;none&gt;        8000/TCP,5001/TCP   8h
iris-model-default-classifier   ClusterIP   10.96.76.141   &lt;none&gt;        9000/TCP            8h
</code></pre>
<p>I wonder why do we have two instead of one.</p>
<p>What are the three ports (8000, 9000, 5001) for respectively? which one should I use?</p>
<p>The manifest yaml is</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
  name: iris-model
  namespace: model-namespace
spec:
  name: iris
  predictors:
  - graph:
      implementation: SKLEARN_SERVER
      modelUri: gs://seldon-models/sklearn/iris
      name: classifier
    name: default
    replicas: 1
</code></pre>
<p>from <a href="https://docs.seldon.io/projects/seldon-core/en/v1.1.0/workflow/quickstart.html" rel="nofollow noreferrer">https://docs.seldon.io/projects/seldon-core/en/v1.1.0/workflow/quickstart.html</a></p>
<p>The CRD definition appears to be <a href="https://github.com/SeldonIO/seldon-core/blob/master/operator/seldon-operator/deploy/crds/machinelearning.seldon.io_seldondeployment_crd.yaml" rel="nofollow noreferrer">here</a> in case it's useful.</p>
<pre><code>k describe service/iris-model-default
Name:              iris-model-default
Namespace:         model-namespace
Labels:            app.kubernetes.io/managed-by=seldon-core
                   seldon-app=iris-model-default
                   seldon-deployment-id=iris-model
Annotations:       getambassador.io/config:
                     ---
                     apiVersion: ambassador/v1
                     kind: Mapping
                     name: seldon_model-namespace_iris-model_default_rest_mapping
                     prefix: /seldon/model-namespace/iris-model/
                     rewrite: /
                     service: iris-model-default.model-namespace:8000
                     timeout_ms: 3000
                     ---
                     apiVersion: ambassador/v1
                     kind: Mapping
                     name: seldon_model-namespace_iris-model_default_grpc_mapping
                     grpc: true
                     prefix: /(seldon.protos.*|tensorflow.serving.*)/.*
                     prefix_regex: true
                     rewrite: &quot;&quot;
                     service: iris-model-default.model-namespace:5001
                     timeout_ms: 3000
                     headers:
                       namespace: model-namespace
                       seldon: iris-model
Selector:          seldon-app=iris-model-default
Type:              ClusterIP
IP:                10.96.82.232
Port:              http  8000/TCP
TargetPort:        8000/TCP
Endpoints:         172.18.0.17:8000
Port:              grpc  5001/TCP
TargetPort:        8000/TCP
Endpoints:         172.18.0.17:8000
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>
<pre><code>k describe service/iris-model-default-classifier 
Name:              iris-model-default-classifier
Namespace:         model-namespace
Labels:            app.kubernetes.io/managed-by=seldon-core
                   default=true
                   model=true
                   seldon-app-svc=iris-model-default-classifier
                   seldon-deployment-id=iris-model
Annotations:       &lt;none&gt;
Selector:          seldon-app-svc=iris-model-default-classifier
Type:              ClusterIP
IP:                10.96.76.141
Port:              http  9000/TCP
TargetPort:        9000/TCP
Endpoints:         172.18.0.17:9000
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>
<pre><code>k get pods --show-labels
NAME                                               READY   STATUS    RESTARTS   AGE   LABELS
iris-model-default-0-classifier-579765fc5b-rm6np   2/2     Running   0          10h   app.kubernetes.io/managed-by=seldon-core,app=iris-model-default-0-classifier,fluentd=true,pod-template-hash=579765fc5b,seldon-app-svc=iris-model-default-classifier,seldon-app=iris-model-default,seldon-deployment-id=iris-model,version=default
</code></pre>
<p>So only one pod is involved, I'm getting the idea that these ports are mapped from different containers:</p>
<pre><code>k get pods -o json | jq '.items[].spec.containers[] | .name, .ports'                                                                                                                           [0] 0s 
&quot;classifier&quot;
[
  {
    &quot;containerPort&quot;: 6000,
    &quot;name&quot;: &quot;metrics&quot;,
    &quot;protocol&quot;: &quot;TCP&quot;
  },
  {
    &quot;containerPort&quot;: 9000,
    &quot;name&quot;: &quot;http&quot;,
    &quot;protocol&quot;: &quot;TCP&quot;
  }
]
&quot;seldon-container-engine&quot;
[
  {
    &quot;containerPort&quot;: 8000,
    &quot;protocol&quot;: &quot;TCP&quot;
  },
  {
    &quot;containerPort&quot;: 8000,
    &quot;name&quot;: &quot;metrics&quot;,
    &quot;protocol&quot;: &quot;TCP&quot;
  }
]
</code></pre>
<p>A more seldon-specific question is why so many ports are needed?</p>

<p>Yes, looks like you have 2 containers in your pod.</p>
<p>The first service:</p>
<p><code>iris-model-default</code> ➡️ <code>seldon-container-engine</code> HTTP: <code>8000:8000</code> and GRPC: <code>5001:8000</code></p>
<p>The second service:</p>
<p><code>iris-model-default-classifier</code> ➡️ <code>classifier</code> HTTP: <code>9000:9000</code> (6000 used internally looks like for metrics)</p>
<p>You didn't mention but sounds like deployed the classifier:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
  name: iris-model
  namespace: seldon
spec:
  name: iris
  predictors:
  - graph:
      implementation: SKLEARN_SERVER
      modelUri: gs://seldon-models/sklearn/iris
      name: classifier
    name: default
    replicas: 1
</code></pre>
<p>If you'd like to find out the rationale behind why the two containers/services you might have dig into the <a href="https://github.com/SeldonIO/seldon-core/tree/master/operator" rel="nofollow noreferrer">operator</a> itself 🔧.</p>
