Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpcbin client possibly not working properly / server has no logs #27

Open
ep4sh opened this issue Aug 7, 2024 · 3 comments
Open

grpcbin client possibly not working properly / server has no logs #27

ep4sh opened this issue Aug 7, 2024 · 3 comments
Assignees

Comments

@ep4sh
Copy link

ep4sh commented Aug 7, 2024

Hi!
I'm trying to run the grpcbin server via:

./grpcbin serve --server="127.0.0.1" --port=55551

But when I do connect via the client:

./grpcbin unary --message hello --server="127.0.0.1" --port=55551

it replies, but no logs on the server side were created.
Also grpcbin doesn't respec --host flag - it continues listening on ::: tcp6 socket (see netstat output)

please be noted, I'm new to gRPC, and it might be that I was wrong :)

image
Looking forward to your comment.

regards,
Pasha.

@ep4sh
Copy link
Author

ep4sh commented Aug 7, 2024

ps when I'm using evans to run Unary svc, I'm able to see response and server's logs.

[email protected]:55551> call Unary
request_attributes::http_code (TYPE_INT32) => 200
request_attributes::delay (TYPE_INT32) => 0
<repeated> request_attributes::response_headers::key (TYPE_STRING) => k1
<repeated> request_attributes::response_headers::value (TYPE_STRING) => v1 
data (TYPE_STRING) => hello
{
  "responseAttributes": {
    "requestHeaders": {
      ":authority": "127.0.0.1:55551",
      "content-type": "application/grpc",
      "grpc-accept-encoding": "gzip",
      "grpc-client": "evans",
      "user-agent": "grpc-go/1.51.0"
    },
    "requesterIp": "127.0.0.1:49652",
    "requesterUserAgent": "grpc-go/1.51.0"
  },
  "result": "hello"
}

@ep4sh ep4sh changed the title grpcbin server possibly not working / no logs grpcbin client possibly not working properly / server has no logs Aug 7, 2024
@Anddd7
Copy link
Owner

Anddd7 commented Aug 11, 2024

@ep4sh got it, i'll take a look ~

@Anddd7 Anddd7 self-assigned this Aug 11, 2024
@Anddd7
Copy link
Owner

Anddd7 commented Aug 12, 2024

@ep4sh This grpcbin is a small tool to test grpc connection, especially in k8s environment.

It only focus on the connection

  • I put everything into the response(e.g. request info, headers)
  • Then, it print those information in client
  • So, i don't print more logs in server side
  • Server only print logs for server-control, e.g. delay, return errors, you can use -d to enable debug logs in server

image

--server and --host are used in remote environment, and only available for client

  • The server will always listen to local
  • --server configures url/ip where the server hosted
  • --host configures the host in request header, which used for routing in L7 loadbalancer, e.g. nginx-ingress

some use cases

  • local pc, no host and server needed, use localhost if you have your own client/server
  • local cluster, if you build a local k8s cluster in a vm, and this server is accessible via an ingress
    • --server would be your vm's ip
    • --host would be the host of your ingress
  • remote cluster, just put your --server and --host with your remote server host

That's how i used grpcbin to test nginx grpc settings in ingress https://github.com/Anddd7/rubber-duck/tree/main/grpcbin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants