<p>The need I have just looks like this stuff :</p>

<pre><code>apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: http
spec:
  serviceName: "nginx-set"
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: gcr.io/google_containers/nginx-slim:0.8
        ports:
        - containerPort: 80
          name: http
----
apiVersion: v1
kind: Service
metadata:
  name: nginx-set
  labels:
    app: nginx
spec:
  ports:
  - port: 80
    name: http
  clusterIP: None
  selector:
    app: nginx
</code></pre>

<p>Here is the interesting part :</p>

<pre><code>apiVersion: voyager.appscode.com/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: default
spec:
  rules:
  - host: appscode.example.com
    http:
      paths:
      - path: '/testPath'
        backend:
          hostNames:
          - web-0
          serviceName: nginx-set #! There is no extra service. This
          servicePort: '80'      # is the Statefulset's Headless Service
</code></pre>

<p>I'm able to target a specific pod because of setting the hostName in function of the url.</p>

<p>Now I'd like to know if it's possible in kubernetes to create a rule like that </p>

<pre><code>apiVersion: voyager.appscode.com/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: default
spec:
  rules:
  - host: appscode.example.com
    http:
      paths:
      - path: '/connect/(\d+)'
        backend:
          hostNames:
          - web-(result of regex match with \d+)
          serviceName: nginx-set #! There is no extra service. This
          servicePort: '80'      # is the Statefulset's Headless Service
</code></pre>

<p>or if I have to wrote a rule for each pod ?</p>

<p>Sorry that isn't possible, the best solution is to create multiple paths, each one referencing one pod:</p>

<pre><code>apiVersion: voyager.appscode.com/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: default
spec:
  rules:
  - host: appscode.example.com
    http:
      paths:
      - path: '/connect/0'
        backend:
          hostNames:
          - web-0
          serviceName: nginx-set
          servicePort: '80'
      - path: '/connect/1'
        backend:
          hostNames:
          - web-1
          serviceName: nginx-set
          servicePort: '80'
</code></pre>
