<p>The domain configured is <code>ticket.devaibhav.live</code></p>
<p><code>ping ticket.devaibhav.live</code> is pointing to the correct IP address of the load balancer provisioned by Digital Ocean. I haven't configured SSL on the cluster yet, but if I try to access my website <a href="http://ticket.devaibhav.live" rel="nofollow noreferrer">http://ticket.devaibhav.live</a> gives an 400 bad request. I am new to kubernetes and networking inside a cluster.</p>
<p>According to my understanding, when browser sends request to <a href="http://ticket.devaibhav.live" rel="nofollow noreferrer">http://ticket.devaibhav.live</a> the request is sent to the Digital Ocean Load balancer and then the ingress service (Ingress-nginx by kubernetes in my case) routes the traffic based on the rules I have defined.</p>
<p>ingress-nginx service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: 'true'
    service.beta.kubernetes.io/do-loadbalancer-hostname: 'ticket.devaibhav.live'
  labels:
    helm.sh/chart: ingress-nginx-2.0.3
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/version: 0.32.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: controller
</code></pre>
<p>ingress resource rules</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: ticket.devaibhav.live
      http:
        paths:
          - path: /api/users/?(.*)
            pathType: Prefix
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000
          - path: /api/tickets/?(.*)
            pathType: Prefix
            backend:
              service:
                name: tickets-srv
                port:
                  number: 3000
          - path: /api/orders/?(.*)
            pathType: Prefix
            backend:
              service:
                name: orders-srv
                port:
                  number: 3000
          - path: /api/payments/?(.*)
            pathType: Prefix
            backend:
              service:
                name: payments-srv
                port:
                  number: 3000
          - path: /?(.*)
            pathType: Prefix
            backend:
              service:
                name: client-srv
                port:
                  number: 3000
</code></pre>
<p>essentially when I hit <a href="http://ticket.devaibhav.live" rel="nofollow noreferrer">http://ticket.devaibhav.live</a> the request should be mapped to the last rule where it must be routed to client-srv.</p>
<p>client deployment and service</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: client
  template:
    metadata:
      labels:
        app: client
    spec:
      containers:
        - name: client
          image: vaibhav908/client

---
apiVersion: v1
kind: Service
metadata:
  name: client-srv
spec:
  selector:
    app: client
  ports:
    - name: client
      protocol: TCP
      port: 3000
      targetPort: 3000
</code></pre>
<p>The above configuration works well on the development server where I am using minikube.
I am unable to understand where I am going wrong with the configuration. I will provide more details as I feel it would be necessary.</p>
<p>[edit]
on the cluster that is deployed
<code>kubectl get services</code></p>
<pre><code>NAME                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
client-srv             ClusterIP   10.245.100.25    &lt;none&gt;        3000/TCP            2d17h
and some other services
</code></pre>
<p><code>kubectl describe ingress</code></p>
<pre><code>Name:             ingress-service
Labels:           &lt;none&gt;
Namespace:        default
Address:          ticket.devaibhav.live
Default backend:  default-http-backend:80 (&lt;error: endpoints &quot;default-http-backend&quot; not found&gt;)
Rules:
  Host                   Path  Backends
  ----                   ----  --------
  ticket.devaibhav.live  
                         /api/users/?(.*)      auth-srv:3000 (10.244.1.76:3000)
                         /api/tickets/?(.*)    tickets-srv:3000 (10.244.0.145:3000)
                         /api/orders/?(.*)     orders-srv:3000 (10.244.1.121:3000)
                         /api/payments/?(.*)   payments-srv:3000 (10.244.1.48:3000)
                         /?(.*)                client-srv:3000 (10.244.1.32:3000)
Annotations:             kubernetes.io/ingress.class: nginx
                         nginx.ingress.kubernetes.io/use-regex: true
Events:                  &lt;none&gt;
</code></pre>

Vaibhav07
<p>Make sure you have your ingress controller configured to respect the proxy protocol settings in the LB. Try adding a proxy <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#use-proxy-protocol" rel="nofollow noreferrer">protocol</a> directive to your config map.</p>
<p>As given in the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#use-proxy-protocol" rel="nofollow noreferrer">document</a>:</p>
<blockquote>
<p>Enables or disables the PROXY protocol to receive client connection
(real IP address) information passed through proxy servers and load
balancers such as HAProxy and Amazon Elastic Load Balancer (ELB).</p>
</blockquote>
