Ingress responds with "backend-404" when using GKE

Using the latest version of Kubernetes in GCP ( 1.6.4 ), I have the following Ingress definition:

 apiVersion: extensions/v1beta1 kind: Ingress metadata: name: myproject namespace: default annotations: ingress.kubernetes.io/rewrite-target: / kubernetes.io/ingress.class: "gce" spec: rules: - host: staging.myproject.io http: paths: - path: /poller backend: serviceName: poller servicePort: 8080 

Here is my service and deployment:

 apiVersion: v1 kind: Service metadata: name: poller labels: app: poller tier: backend role: service spec: type: NodePort selector: app: poller tier: backend role: service ports: - port: 8080 targetPort: 8080 --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: poller spec: replicas: 1 template: metadata: labels: app: poller tier: backend role: service spec: containers: - name: poller image: gcr.io/myproject-1364/poller:latest imagePullPolicy: Always env: - name: SPRING_PROFILES_ACTIVE value: staging - name: GET_HOSTS_FROM value: dns ports: - containerPort: 8080 

In my /etc/hosts , I have a line like:

 35.190.37.148 staging.myproject.io 

However, I get the default backend - 404 when twisting any endpoint on staging.myproject.io :

 $ curl staging.myproject.io/poller/cache/status default backend - 404 

I have the same configuration that works locally inside Minikube, with the only difference being that it is a domain ( dev.myproject.io ) and it works like a charm.

I read and tried almost everything I could find, including material from here and here and here , but maybe I just missed something ... any ideas?

+5
source share
1 answer

It really takes 5-10 minutes for Ingress to actually become usable in GKE. Meanwhile, you can see answers with the status of 404, 502 and 500.

There's an introduction tutorial here: https://cloud.google.com/container-engine/docs/tutorials/http-balancer I recommend following it. Based on what you inserted, I can say the following:

  • You use service.Type = NodePort, which is correct.
  • I am not sure about the annotation ingress.kubernetes.io/rewrite-target , it is possible that the problem.
  • Make sure your application responds 200 OK to the GET / request.
  • I also understand that you are curl http://<ip>/ , but your Ingress specification only handles the /poller . So it's normal that you get the default backend - 404 response default backend - 404 when requesting / . You have not configured any servers for the path / in the Ingress specification.
+3
source

Source: https://habr.com/ru/post/1268509/


All Articles