2

I have followed the this guide https://knative.dev/docs/serving/cluster-local-route/ to make a service cluster-local.

I am trying to access that service from another service that is inside the cluster using curl command but i always get could not resolve host error.

I have tried to make request with the curl helloworld-default.svc.cluster and curl -H "Host: helloworld-go.default.svc.cluster" http://< cluster_ip > command.

I am missing something? Do i need to make any configuration to Istio virtualService to make it work? (I am running Knative inside GKE)

Alexis_Ni
  • 907
  • 7
  • 14

1 Answers1

1

I think you are missing the .local and it should work.

curl -H "Host: helloworld-go.default.svc.cluster.local" http://< cluster_ip > 

But you should be able to drop the ClusterIP entirely as you are making the request from within the cluster. Basically execute:

curl helloworld-go.default.svc.cluster.local

The DNS helloworld-go.default.svc.cluster.local will be resolved by the Kubernetes DNS resolution mechanism.


It's important to specify the HOST header only on ingress traffic (public traffic entering into private traffic).

Details: The Knative Service creates a Route CRD, which creates a ClusterIngress which will be picked up by a controller (by default istio-network) to configure the Ingress Gateway (using another CRD in istio's case VirtualService). Ingress Gateways routing is based on the HOST header.

Rinor
  • 1,790
  • 13
  • 22
  • Thank for the response, the problem was that the default installation of Knative at GKE didn't have cluster local gateway installed. – Alexis_Ni Oct 08 '19 at 10:27
  • Cool, I'd love to see a longer answer so that I can learn from it – Rinor Oct 08 '19 at 10:29