<p>Rancher ingress return 404 to service.</p>
<p>Setup: I have 6 VMs, one Rancher server x.x.x.51 (where dns domain.company is pointing to, TLS), and 5 VMs (one master and 4 worker x.x.x.52-56).</p>
<p>My service, gvm-gsad running in gvm namespace:</p>
<pre><code>   apiVersion: v1
kind: Service
metadata:
 annotations:
   field.cattle.io/publicEndpoints: &quot;null&quot;
   meta.helm.sh/release-name: gvm
   meta.helm.sh/release-namespace: gvm
 creationTimestamp: &quot;2021-11-15T21:14:21Z&quot;
 labels:
   app.kubernetes.io/instance: gvm-gvm
   app.kubernetes.io/managed-by: Helm
   app.kubernetes.io/name: gvm-gsad
   app.kubernetes.io/version: &quot;21.04&quot;
   helm.sh/chart: gvm-1.3.0
 name: gvm-gsad
 namespace: gvm
 resourceVersion: &quot;3488107&quot;
 uid: c1ddfdfa-3799-4945-841d-b6aa9a89f93a
spec:
 clusterIP: 10.43.195.239
 clusterIPs:
 - 10.43.195.239
 ipFamilies:
 - IPv4
 ipFamilyPolicy: SingleStack
 ports:
 - name: gsad
   port: 80
   protocol: TCP
   targetPort: gsad
 selector:
   app.kubernetes.io/instance: gvm-gvm
   app.kubernetes.io/name: gvm-gsad
 sessionAffinity: None
 type: ClusterIP
status:
 loadBalancer: {}
</code></pre>
<p>My ingress configure: Ingress controller is default one from rancher.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    field.cattle.io/publicEndpoints: '[{&quot;addresses&quot;:[&quot;172.16.12.53&quot;],&quot;port&quot;:443,&quot;protocol&quot;:&quot;HTTPS&quot;,&quot;serviceName&quot;:&quot;gvm:gvm-gsad&quot;,&quot;ingressName&quot;:&quot;gvm:gvm&quot;,&quot;hostname&quot;:&quot;dtl.miproad.ad&quot;,&quot;path&quot;:&quot;/gvm&quot;,&quot;allNodes&quot;:true}]'
  creationTimestamp: &quot;2021-11-16T19:22:45Z&quot;
  generation: 10
  name: gvm
  namespace: gvm
  resourceVersion: &quot;3508472&quot;
  uid: e99271a8-8553-45c8-b027-b259a453793c
spec:
  rules:
  - host: domain.company
    http:
      paths:
      - backend:
          service:
            name: gvm-gsad
            port:
              number: 80
        path: /gvm
        pathType: Prefix
  tls:
  - hosts:
    - domain.company
status:
  loadBalancer:
    ingress:
    - ip: x.x.x.53
    - ip: x.x.x.54
    - ip: x.x.x.55
    - ip: x.x.x.56
</code></pre>
<p>When i access it with <a href="https://domain.company/gvm" rel="nofollow noreferrer">https://domain.company/gvm</a> then i get 404.</p>
<p>However, when i change the service to NodePort, i could access it with x.x.x.52:PORT normally. Meaning the deployment is running fine, just some configuration issue in ingress.</p>
<p>I checked this one: <a href="https://stackoverflow.com/questions/52442868/rancher-2-x-thru-ingress-controller-returns-404">rancher 2.x thru ingress controller returns 404</a> but it does not help.</p>
<p>Thank you in advance!</p>

Viet Nguyen
<p>Figured out the solution.</p>
<p>The domain.company is pointing to rancher (x.x.x.51). Where the ingress is running on (x.x.x.53,.54,.55,.56).</p>
<p>So, the solution is to create a new DNS called gvm.domain.company pointing to any ingress (x.x.x.53,.54,.55,.56) (you can have LoadBalancer here or use round robin DNS).</p>
<p>Then, the ingress definition is gvm.domain.company and path is &quot;/&quot;.</p>
<p>Hope it helps others!</p>
