0

I have a service which is accepting the request at /api/v1/orders. I was able to validate the response using the Cluster IP. I logged into a pod and hit the curl http://order-service/api/v1/orders and getting the response.

I then set up a Nginx Ingress Controller and the ingress with the below yaml definition. I used the cafe example and the cafe ingress is working fine.

When I try to access my order-service I am getting 404. I am not sure how to debug this.

Note: My API is accessible on http://context/api/v1/orders endpoint. How do I redirect the path the /orders/api/v1/orders from the ingress?

curl -v -H "Content-type: application/j son" -H "Accept: application/json" https://classpath.com/orders/api/v1/orders --insec ure

apiVersion: networking.k8s.io/v1beta1                          
kind: Ingress                                                  
metadata:                                                      
  name: orders-microservice-ingress                            
spec:                                                          
  ingressClassName: nginx # use only with k8s version >= 1.18.0
  tls:                                                         
  - hosts:                                                     
    - classpath.com                                            
    secretName: cafe-secret                                    
  rules:                                                       
  - host: classpath.com                                        
    http:                                                      
      paths:                                                   
      - path: /orders                            
        backend:                                               
          serviceName: order-service                           
          servicePort: 80                                      

I have set the aws loadbalancer IP to classpath.com in the /etc/hosts file.

zilcuanu
  • 3,451
  • 8
  • 52
  • 105
  • How about [rewrite-target](https://kubernetes.github.io/ingress-nginx/examples/rewrite/#rewrite-target)? Would it solve it? – Matt Jun 18 '21 at 08:47
  • I think the answer to this question [kubernetes-ingress-non-root-path-404-not-found](https://stackoverflow.com/questions/52021925/kubernetes-ingress-non-root-path-404-not-found/71039020#71039020) can help – KwakuCsc Feb 08 '22 at 18:35

0 Answers0