<p>I'm trying to create an <code>Ingress</code> rule to redirect requests from LoadBalancer to Service.</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hostlessendpoint
spec:
  rules:
  - http:
      paths:
      - path: /hostless
        backend:
          serviceName: node-red
          servicePort: 1880
</code></pre>
<p>The above yaml script is supposed to redirect all requests from <code>https://LOAD_BALANCER_IP/hostless</code> to <code>node-red</code> on port <code>1880</code></p>
<p>If I try to request the above URL, I got an error <code>Cannot GET /hostless</code>. Requesting the root gives <code>404 page not found</code>.</p>
<p>I can access my services with the direct URL (eg. <code>http://LOAD_BALANCER_IP:1880</code> will redirect to Node-red service).</p>
<p>Service yaml looks like that:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: node-red
  name: node-red
spec:
  ports:
    - name: &quot;1880&quot;
      port: 1880
      protocol: TCP
      targetPort: 1880
  selector:
    app: node-red
  sessionAffinity: None
  type: LoadBalancer
</code></pre>
<p>How to use <code>ingress</code> to reach a service whereas a custom port ?</p>

Manitoba
<p>I've found a way to make it works !</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    traefik.ingress.kubernetes.io/redirect-entry-point: https
    kubernetes.io/ingress.class: &quot;traefik&quot;
    traefik.ingress.kubernetes.io/router.middlewares: &quot;kube-system-traefik-stripprefix@kubernetescrd&quot;
  name: traefik-all
  namespace: partner
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: nginx-demo
          servicePort: 2222
      - path: /node
        backend:
          serviceName: node-red
          servicePort: 1880
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: traefik-stripprefix
  namespace: kube-system
spec:
  stripPrefixRegex:
    regex:
      - &quot;/[^/]+&quot;
</code></pre>
<p>I use a middleware to remove the prefix as K3S Traefik does not support the <code>traefik.ingress.kubernetes.io/rewrite-target</code> annotation.</p>
<p>With the above code, all trafic from <code>LOAD_BALANCER_IP/*</code> will be redirected to <code>nginx-demo:2222</code> service. All trafic from <code>LOAD_BALANCER_IP/node/*</code> will be redicted to <code>node-red:1880</code> service.</p>
<p>I hope this could help someone !</p>
