<p>Stack:
Azure Kubernetes Service<br />
NGINX Ingress Controller - <a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx</a> <br />
AKS Loadbalancer<br />
Docker containers</p>
<p>My goal is to create a K8s cluster that will allow me to use multiple pods, under a single IP, to create a microservice architecture. After working with tons of tutorials and documentation, I'm not having any luck with my endgoal. I got to the point of being able to access a single deployment using the Loadbalancer, but introducing the ingress has not been successful so far. The services are separated into their respective files for readability and ease of control.</p>
<p>Additionally, the Ingress Controller was added to my cluster as described in the installation instructions using: <code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.35.0/deploy/static/provider/cloud/deploy.yaml</code></p>
<p>LoadBalancer.yml:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: backend
spec:
  loadBalancerIP: x.x.x.x
  selector:
    app: ingress-service
    tier: backend
  ports:
  - name: &quot;default&quot;
    port: 80
    targetPort: 80
  type: LoadBalancer
</code></pre>
<p>IngressService.yml:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - http:
      paths:
      - path: /api
        backend:
          serviceName: api-service
          servicePort: 80
</code></pre>
<p>api-deployment.yml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: api-service
spec:
  selector:
    app: api
  ports:
    - port: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
   name: api-deployment
spec:
  selector:
    matchLabels:
      app: api
      tier: backend
      track: stable
  replicas: 1
  template:
    metadata:
      labels:
        app: api
        tier: backend
        track: stable
    spec:
      containers:
      - name: api
        image: image:tag
        ports:
        - containerPort: 80
        imagePullPolicy: Always
      imagePullSecrets:
      - name: SECRET
</code></pre>
<p>The API in the image is exposed on port 80 correctly.</p>
<p>After applying each of the above yml services and deployments, I attempt a web request to one of the api resources via the LoadBalancer's IP and receive only a timeout on my requests.</p>

Carson
<p>Found my answer after hunting around enough. Basically, the problem was that the Ingress Controller has a Load Balancer built into the yaml, as mentioned in comments above. However, the selector for that LoadBalancer requires marking your Ingress service as part of the class. Then that Ingress service points to each of the services attached to your pods. I also had to make a small modification to allow using a static IP in the provided load balancer.</p>
