docs/serving/samples/grpc-ping-go
Ahmet Alp Balkan 9f04556a89 samples/grpc-ping-go: don't provide default (#959)
I was trying to connect to my grpc service at a custom domain like
`grpc-ping.default.IP.IP.IP.IP.xip.io` while omitting -server_host_override
and it resulted in bug https://github.com/knative/serving/issues/3307 which
took several days to figure out there was a default value for this flag.

Removing the default value as nobody's really owning grpc.knative.dev or
setting it as the custom domain in this sample.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-03-07 14:35:41 -08:00
..
client samples/grpc-ping-go: don't provide default (#959) 2019-03-07 14:35:41 -08:00
proto Clean up folder names to match helloworld style (#62) 2018-07-10 10:14:34 -07:00
Dockerfile Fix up the GRPC sample in preparation for 0.4 (#903) 2019-02-19 07:15:48 -08:00
README.md Fix docs (#935) 2019-02-27 10:03:49 -08:00
grpc-ping.go Fix spelling errors (#605) 2018-11-28 10:40:23 -08:00
sample.yaml Fix up the GRPC sample in preparation for 0.4 (#903) 2019-02-19 07:15:48 -08:00

README.md

gRPC Ping

A simple gRPC server written in Go that you can use for testing.

This sample requires knative/serving 0.4 or later.

Prerequisites

  1. Install Knative
  2. Install docker

Build and run the gRPC server

First, build and publish the gRPC server to DockerHub (replacing {username}):

# Build and publish the container, run from the root directory.
docker build \
  --tag "docker.io/{username}/grpc-ping-go" \
  --file=serving/samples/grpc-ping-go/Dockerfile .
docker push "docker.io/{username}/grpc-ping-go"

Next, replace {username} in sample.yaml with your DockerHub username, and apply the yaml.

kubectl apply --filename serving/samples/grpc-ping-go/sample.yaml

Use the client to stream messages to the gRPC server

  1. Fetch the created ingress hostname and IP.
# Put the Host name into an environment variable.
export SERVICE_HOST=`kubectl get route grpc-ping --output jsonpath="{.status.domain}"`

# Put the ingress IP into an environment variable.
export SERVICE_IP=`kubectl get svc istio-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
  1. Use the client to send message streams to the gRPC server (replacing {username})
docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \
  -server_addr="${SERVICE_IP}:80" \
  -server_host_override="${SERVICE_HOST}" \
  -insecure