Can't use curl with Host header with a GKE Ingress

2/28/2019

I have a website deployed on a GKE cluster, the website is published on a the domain example.com with exposed to the internet with an ingress object with IP 1.1.1.1 for example.
I can browse to the example.com without problem, but I expected to see my website when issuing this command too:
curl -verbose --header 'Host: example.com' 1.1.1.1
But instead, I'm getting the Google's 404 page.
Why is that?
There are no Cloud Armor or any kind of firewalls in place.
The ingress configuration is as follows:

kubectl describe ingresses.extensions wordpress-ingress -n examplens
Name:             wordpress-ingress
Namespace:        examplens
Address:          1.1.1.1
Default backend:  web-backend:80 (10.1.2.3:8080)
Rules:
  Host                   Path  Backends
  ----                   ----  --------
  example.com        
                         /*   wordpress-proxy:8081 (<none>)
Annotations:
  ingress.kubernetes.io/target-proxy:     k8s-tp-examplens-examplens-wordpress-ingress--0954ac07ad1bc6
  ingress.kubernetes.io/url-map:          k8s-um-examplens-examplens-wordpress-ingress--0954ac07ad1bc6
  ingress.kubernetes.io/backends:         {"k8s-be-31096--57aec84fb5d3ea3d":"HEALTHY","k8s-be-31366--57aec84fb5d3ea3d":"HEALTHY","k8s-be-31651--57aec84fb5d3ea3d":"HEALTHY","k8s-be-31864--57aec84fb5d3ea3d":"HEALTHY"}
  ingress.kubernetes.io/forwarding-rule:  k8s-fw-examplens-examplens-wordpress-ingress--ef63350eae86dd
Events:           <none>
-- Sam
google-kubernetes-engine
kubernetes-ingress

1 Answer

3/1/2019

Sam,

Looks like the issue is the path defined to your backend in the URL Map. Try to use the following command instead:

curl -verbose --header 'Host: example.com' http://1.1.1.1/
-- Eduardo Ruela
Source: StackOverflow