Skip to content

gRPC apps cannot be invoked without setting host explicitly #3370

@ahmetb

Description

@ahmetb

Problem: I have a set of gRPC microservices (written in Go, Python, Ruby, Node.js, .NET and Java) that work fine on Kubernetes. However if I migrate them to Knative, I have to make "code changes" to ALL of these services explicitly set the host header, ideally I wasn't hoping to do that.

When you deploy a gRPC app to Knative, you have to explicitly specify its hostname.

For example, if an app is calling into a gRPC service on Knative, it must do:

conn, err := grpc.Dial("grpc-ping.default.svc.cluster.local:80", 
    grpc.WithInsecure(),
    grpc.WithAuthority("grpc-ping.default.svc.cluster.local"))
...

Without specifying the WithAuthority dial option, the response always gives error:

rpc error: code = Unimplemented desc = :

On the other hand, if I wasn't deploying the gRPC app to Knative, I could just connect to it by saying:

conn, err := grpc.Dial("grpc-ping.default.svc.cluster.local:80", grpc.WithInsecure())

It would be great if running gRPC apps on Knative didn't come with this cost of explicitly re-specifying the host header. This is costly if I'm doing service discovery through a variable like OTHER_SERVICE_ADDR=grpc-ping.default.svc.cluster.local:80 as now I have to split the host/port. And I also have to refactor my code to work on Knative.

I recommend we:

  • find a way to do this without requiring users to set Authority explicitly
  • figure out who's sending gRPC unimplemented response and add an explicit error message to gRPC status like request doesn't specify an authority (Host header), knative cannot route this request so others don't spend multiple days debugging.

/area networking
/kind bug

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions