0

I'm working with k8s and gcloud to deploy a multi-service application with Ingress being responsible for routing requests to a specific service. K8s and generally infrastructure is a new area of learning for me so it's been very trial and error so far, but now I have hit a wall.

I've been experimenting and building my deployment using minikube and I have created a yaml file that will successfully deploy everything locally on minikube without error. You can see the full deployment yaml file here: https://github.com/mwinteringham/restful-booker-platform/blob/kubes/kubes/deploy.yml

The issue I have run into is when I run the deployment on gcloud I am hitting 404s all over the place. With the current config, I am able to access rbp-ui by updating my /etc/hosts to point to rbp.info but attempt to access any other service endpoints I get a 404, meaning I can't get past my login screen.

The Ingress configuration is below and I believe I am missing something but I have no idea what.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: rbp-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: rbp.info
    http:
      paths:
      - path: /booking
        backend:
          serviceName: rbp-booking
          servicePort: 3000
      - path: /room
        backend:
          serviceName: rbp-room
          servicePort: 3001
      - path: /search
        backend:
          serviceName: rbp-search
          servicePort: 3002
      - path: /
        backend:
          serviceName: rbp-ui
          servicePort: 3003          
      - path: /auth
        backend:
          serviceName: rbp-auth
          servicePort: 3004
      - path: /report
        backend:
          serviceName: rbp-report
          servicePort: 3005
      - path: /*
        backend:
          serviceName: rbp-ui
          servicePort: 3003

Some other things to add:

  1. I have left the deployment run for approx. 10 minutes to make sure the initial startup 404s are done
  2. All the services have a valid healthcheck endpoint, so gcloud informs that all backend services are healthy
2bittester
  • 11
  • 3
  • Looking at the YAML file for the ingress all the paths are listed as follows: - path: /booking - path: /room - path: /search - path: /auth - path: /report Please consider adding the * at the end, as this might be the root cause of the issue; this is explained in [here](https://github.com/kubernetes/ingress-nginx/issues/555#issuecomment-291532912) and documented in [here](https://github.com/kubernetes/ingress-gce#paths). The path should be as follows: - path: /booking/* - path: /room/* - path: /search/* - path: /auth/* - path: /report/* – mehdi sharifi Aug 09 '18 at 14:20
  • Are you able to reach the services locally via the serviceIP and pod IP, to test them ? You can SSH into the node and curl IP/path:port exposed. – mehdi sharifi Aug 09 '18 at 14:24

1 Answers1

1

Thanks to mehdi sharifi I managed to solve this. I removed the re-write-target option and then used wildcards to get the routing working.

Ultimately for APIs that had paths such as /booking and /booking/1 I had to ensure that I had created two entries like so:

paths:
- path: /booking
  backend:
    serviceName: rbp-booking
    servicePort: 3000
- path: /booking/*
  backend:
    serviceName: rbp-booking
    servicePort: 3000
2bittester
  • 11
  • 3