<p>I may misunderstand this concept:</p>
<p>I have two services (Frontend and API). Both should to use one subdomain (my.domain.com):</p>
<ul>
<li><code>domain.com     =&gt; for FRONTEND ('hello-world')</code></li>
<li><code>domain.com/api =&gt; for API</code></li>
</ul>
<p>I have a K8s-cloud running at Hetzner. Hetzner also provides loadbalancers. The cluster was created with <code>Rancher</code>-UI</p>
<p>This is how I configure the <code>loadbalancer Service</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: &quot;v1&quot;
kind: Service
metadata:
  name: &quot;nginx-hello-world&quot;
  labels:
    app: &quot;hello-world&quot;
  annotations:
    load-balancer.hetzner.cloud/name: lb-development
    load-balancer.hetzner.cloud/hostname: my.domain.com
    load-balancer.hetzner.cloud/protocol: http
spec:
  type: LoadBalancer
  selector:
    app: &quot;hello-world&quot;
  ports:
    - name: &quot;http&quot;
      port: 80
      targetPort: 80
</code></pre>
<p>And this is my <code>Deployment</code> for the frontend <code>hello-world</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: &quot;apps/v1&quot;
kind: &quot;Deployment&quot;
metadata:
  name: &quot;nginx-hello-world&quot;
  labels:
    app: &quot;hello-world&quot;
spec:
  selector:
    matchLabels:
      app: &quot;hello-world&quot;
  strategy:
    type: &quot;Recreate&quot;
  template:
    metadata:
      labels:
        app: &quot;hello-world&quot;
    spec:
      containers:
        - image: &quot;rancher/hello-world&quot;
          name: &quot;nginx-hello-world&quot;
          imagePullPolicy: &quot;Always&quot;
          ports:
            - containerPort: 80
              name: &quot;http&quot;
</code></pre>
<p>The two manifests above are WORKING! I can reach out to 'hello-world' by visiting <code>my.domain.com/</code></p>
<p>Now I wanna hook my backend API into that setup. I thought I can do this by using an <code>ingress</code> manifest:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  labels:
    app: my-ingress
  name: my-ingress
spec:
  rules:
  - host: my.domain.com
    http:
      paths:
      - backend:
          serviceName: hello-api
          servicePort: 80
        path: &quot;/app&quot;
        pathType: Prefix
      - backend:
          serviceName: hello-world
          servicePort: 80
        path: &quot;/&quot;
        pathType: Prefix
</code></pre>
<blockquote>
<p>How can I achieve to connect another <code>workload</code> with <code>my.domain.com/api for the API</code> and keep the use of the Hetzner loadbalancer?</p>
</blockquote>
<p>I thought I can do that, by simply changing the selector in the <code>Loadbalancer Service</code> to point to <code>my-ingress</code>, but nothing I tried, worked so far.</p>
<pre><code>┌─────────────────┐  ┌──────────────────┐   ┌──────────────────┐
│                 │  │  Ingress         │   │                  │
│ Loadbalancer Svc├─►│my.domain.com/    ├──►│ Frontend deploym.│
│                 │  │my.domain.com/api ├──►│ backend API depl │
└─────────────────┘  └──────────────────┘   └──────────────────┘
</code></pre>
<p>PS: it may be interesting: When I deployed Rancher, it has also created a <code>nginx-ingress-controller</code></p>
<p>Thank you in advance</p>

Jan
<p>You need to create a service of type: LoadBalancer
and use the the ingress controller app's label in the selector as explained in the link below. Although, the link talks about using Traefik, the process should be same for the Nginx ingress controller.</p>
<p><a href="https://community.hetzner.com/tutorials/howto-k8s-traefik-certmanager" rel="nofollow noreferrer">https://community.hetzner.com/tutorials/howto-k8s-traefik-certmanager</a></p>
