<p>I currently have a load balancer per pod.  In my instance 2 pods with the following YAML definitions.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: service1
spec:
  ports:
  - name: https-service1
    port: 6379
    targetPort: 6379
  selector:
       app: service1-consoleapp
  type: LoadBalancer

apiVersion: v1
kind: Service
metadata:
  name: service2
spec:
  ports:
  - name: https-service2
    port: 443
    targetPort: 443
  selector:
       app: service2-consoleapp
  type: LoadBalancer
</code></pre>
<p>When I apply the above 2 yaml files I will get 2 external ip's that I then use to configure my A records in my dns subdomains.</p>
<p>service1.company.com   =&gt;  external ip 1 for service1-consoleapp</p>
<p>service2.company.com   =&gt;  external ip 2 for service2-consoleapp</p>
<p>Is there a way to combine the YAML file into one,  so that I can only use one IP address instead of 2 ?</p>
<p>Also , it looks like in ingress you can do it but not sure how I deal with the &quot;host&quot; requirement.</p>
<p>Can someone please explain how the routing will work as I'm not sure what values should be in the path property ?</p>
<p>Will I still get 2 external ip's on this that I can use to populate the dns subdomains ?</p>
<pre><code> spec:
  rules:
  - host: service1.company.com
    http:
      paths:
      - backend:
          serviceName: service1
          servicePort: 6379
        path: ??
  - host: service2.company.com
    http:
      paths:
      - backend:
          serviceName: service2
          servicePort: 433
        path: ??
</code></pre>
<p>The result I'm looking for is if I type</p>
<p>service1.company.com:6379 in my browser then I should hit the pod endpoint (service1-consoleapp) and if I type</p>
<p>service2.company.com:443 in my browser then I should hit the pod endpoint (service2-consoleapp).</p>
<p>where the service1.company.com and service2.company.com is on the same IP address.</p>
<p>thanks in advance.</p>

JTM
<p>You better work with Microsoft documentation -  <a href="https://learn.microsoft.com/en-us/azure/aks/ingress-basic" rel="nofollow noreferrer">Create an ingress controller in Azure Kubernetes Service (AKS)</a>.</p>
<p><strong>From the docs:</strong></p>
<blockquote>
<p>An ingress controller is a piece of software that provides reverse
proxy, configurable traffic routing, and TLS termination for
Kubernetes services. Kubernetes ingress resources are used to
configure the ingress rules and routes for individual Kubernetes
services. Using an ingress controller and ingress rules, a single IP
address can be used to route traffic to multiple services in a
Kubernetes cluster.</p>
</blockquote>
<p>Follow the documentation and set an ingress.</p>
<p>Later on, Follow <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Kubernetes documentation</a> as @CSharpRocks offered in the comments.</p>
<p><strong>From the docs:</strong></p>
<blockquote>
<p>If you create an Ingress resource without any hosts defined in the
rules, then any web traffic to the IP address of your Ingress
controller can be matched without a name based virtual host being
required.</p>
<p>For example, the following Ingress resource will route traffic
requested for first.bar.com to service1, second.foo.com to service2,
and any traffic to the IP address without a hostname defined in
request (that is, without a request header being presented) to
service3.</p>
</blockquote>
<p><strong>Yaml example:</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: name-virtual-host-ingress
spec:
  rules:
  - host: first.bar.com
    http:
      paths:
      - backend:
          serviceName: service1
          servicePort: 80
  - host: second.foo.com
    http:
      paths:
      - backend:
          serviceName: service2
          servicePort: 80
  - http:
      paths:
      - backend:
          serviceName: service3
          servicePort: 80
</code></pre>
<p>More about <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types" rel="nofollow noreferrer">Path types</a>.</p>
