<p>I am trying to add an ingress rule to an internal load balancer. As per the dock it can be redirected to a service. It works as long as the service is "ClusterIP" but goes to infinite redirect when its "LoadBalancer"</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: demo-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - demo.azure.com
    secretName: aks-ingress-tls
  rules:
  - host: demo.azure.com
    http:
      paths:
      - path: /
        backend:
          serviceName: aks-helloworld
          servicePort: 80
      - path: /demo
        backend:
          serviceName: demo-backend
          servicePort: 80
</code></pre>

<p><a href="https://demo.azure.com" rel="nofollow noreferrer">https://demo.azure.com</a>  works but <a href="https://demo.azure.com/demo" rel="nofollow noreferrer">https://demo.azure.com/demo</a> doesn’t. Difference is aks-helloworld is a ClusterIP but demo-backend is a LoadBalancer</p>

<pre><code>13:33 $ kubectl get services
NAME                  TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)        AGE
aks-helloworld        ClusterIP      10.0.204.168   &lt;none&gt;         80/TCP         15m
kubernetes            ClusterIP      10.0.0.1       &lt;none&gt;         443/TCP        16h
demo-backend   LoadBalancer   10.0.198.251   23.99.128.86   80:30332/TCP   15h
</code></pre>

Neil
<p>For your issue, I don't think it's the problem that one has the type clusterIP and another has the type LoadBalancer. When the traffic coming in through the two ways, they will all redirect to the service, in your case, demo-backend.</p>

<p>See the result of the test on my side:</p>

<p><a href="https://i.stack.imgur.com/pHlnO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pHlnO.png" alt="enter image description here"></a></p>

<p>Access from the Internet:</p>

<p><a href="https://i.stack.imgur.com/HVwBS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HVwBS.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/y3oC5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y3oC5.png" alt="enter image description here"></a></p>

<p>I do not add the TLS, but I think the traffic will all redirect to the service no matter it has the TLS or not. I just change the command with <code>--set serviceType="LoadBalancer"</code> when I install the second application through helm. So you can check if there something wrong with your steps.</p>

<p>But I don't think it's a good way to route traffic both in these two ways to one service. If you use the TLS through Ingress, and it will be no secure when there is the way with LoadBalancer at the same time. Because the traffic will bypass the TLS through LoadBalancer.</p>

<p><strong>Update</strong></p>

<p>With your comment, I think you need to create a deployment for your application, and then create a service with it, the file like this:</p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: yourImage
        ports:
        - containerPort: 80
          name: myapp
---
apiVersion: v1 
kind: Service 
metadata: 
    name: demo-backend 
    labels: 
        app: myapp 
spec: 
    type: ClusterIP 
    selector: 
        app: myapp 
    ports: 
    - port: 80
      name: http
</code></pre>

<p>The deployment is the basis of the application, the service just accepts the traffic for the pod. So I guess you miss the deployment so that you can access your application.</p>
