Nginx ingress controller configuration (gke)

10/29/2019

I've done the installation of Nginx Ingress Controller by using this guide (https://kubernetes.github.io/ingress-nginx/deploy/) in 2 steps:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml

Then it created for me 2 entities :

enter image description here

first entity is called ingress-nginx in service & ingress section and the second one:

enter image description here

inside workloads section called nginx-ingress-controller. Next step of my configuration process was creating service with Ingress type:

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 annotations:
  kubernetes.io/ingress.class: "nginx-ingress-controller"
  nginx.ingress.kubernetes.io/rewrite-target: /
  nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
  kubernetes.io/ingress.global-static-ip-name: my static ip
 name: booknotes-ingress 
 namespace: 'default'  
spec:
 rules:
 - host: www.domain.com
   http:
     paths:
     - path: /*
       backend:
         serviceName: booknotes-service
         servicePort: 80

Then I've exposed booknotes-service from my booknotes (Depoloyment) with Custer IP type . But when I go to www.domain.com it is in a pending state . What I've done wrong ? And I don't really understand well all the flow from the request to my pod in this case.

-- Andrey Radkevich
google-kubernetes-engine
kubernetes
nginx-ingress

1 Answer

10/30/2019

Have you binded the external ip address of your ingress controller to your dns? Can you resolve the dns? Try nslookup www.domain.com and check if the ip address is the one of your ingress controller.

Once you resolve the problem with the dns you may get either a 404 or a 502 as response. Which means you are resolving but not passing traffic to the service. Update your question with that and we can continue.

Pd.- Remove the /* in the path definition of the ingress resource. Just /

-- Rodrigo Loza
Source: StackOverflow