<p>Using a STS with 3 pods: &quot;pod-0, pod-1, pod-2&quot; to create an Apache Spark cluster, each pod is a worker with logs available via HTTP.</p>
<p>In order to see logs, I would like to access to all pods via a HTTP ingress, something like:</p>
<p>&quot;https://pod-0.my-ingress.domain&quot; or &quot;https://my-ingress.domain/pod-0&quot;</p>
<p>Is it possible to do this automatically by declaring a single Ingress?</p>

Thomas Decaux
<p>There is no out of the box solution in kubernetes for this, but you could create service per each pod in the statefulset and then reference it in the ingress:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sts-ingress
spec:
  rules:
  - http:
      paths:
      - path: /pod-0
        pathType: Prefix
        backend:
          service:
            name: pod-0
            port:
              number: 80
      - path: /pod-1
        pathType: Prefix
        backend:
          service:
            name: pod-1
            port:
              number: 80
</code></pre>
<p>You could leverage operator pattern to automate it, an example of metacontroller already exists for this use case: <a href="https://github.com/metacontroller/metacontroller/tree/master/examples/service-per-pod" rel="nofollow noreferrer">https://github.com/metacontroller/metacontroller/tree/master/examples/service-per-pod</a></p>
