Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
client
manifests Add gRPC greeter sample application (#27) Jun 28, 2019
server
README.md Add gRPC greeter sample application (#27) Jun 28, 2019

README.md

grpc-greeter-go

This sample application consists of a gRPC server and client.

It is a adapted from the gRPC-Go helloworld example.

The main changes from the original version are:

  • the server returns the hostname where it runs in a gRPC header; and

  • the client prints the hostname header from the gRPC response.

This is useful for testing request routing and load balancing functionality.

When running in a Kubernetes cluster, the hostname is the name of the Kubernetes Pod that served the request.

Usage

Build container images for the gRPC client and server:

docker build client -t grpc-greeter-go-client

docker build server -t grpc-greeter-go-server

Start the server:

docker run --detach --name grpc-server --rm grpc-greeter-go-server --address :8000

Run the client and send three requests:

docker run --network container:grpc-server --rm grpc-greeter-go-client --address localhost:8000 --insecure --repeat 3

Stop the server:

docker stop grpc-server

Disclaimer

This is not an officially supported Google product.

You can’t perform that action at this time.