docs/serving/samples/grpc-ping
Nghia Tran b97fa65aec Update samples to not use Ingress. (#60)
* Update samples to not use Ingress.

This is follow-up of https://github.com/knative/serving/pull/1228.  We
moved to Istio v1alpha3 / Gateway which requires a different way to
get the external IP address to send traffic to our samples.

* Also update the command to find service domain.
2018-07-02 14:07:17 -07:00
..
client Migrate samples from knative/serving (#22) 2018-06-26 14:58:54 -07:00
proto Migrate samples from knative/serving (#22) 2018-06-26 14:58:54 -07:00
Dockerfile Migrate samples from knative/serving (#22) 2018-06-26 14:58:54 -07:00
README.md Update samples to not use Ingress. (#60) 2018-07-02 14:07:17 -07:00
grpc-ping.go Migrate samples from knative/serving (#22) 2018-06-26 14:58:54 -07:00
sample.yaml Migrate samples from knative/serving (#22) 2018-06-26 14:58:54 -07:00

README.md

gRPC Ping

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

This sample is dependent on this issue to be complete.

Prerequisites

  1. Install Knative
  2. Install docker

Build and run the gRPC server

Build and run the gRPC server. This command will build the server and use kubectl to apply the configuration.

REPO="gcr.io/<your-project-here>"

# Build and publish the container, run from the root directory.
docker build \
  --build-arg SAMPLE=grpc-ping \
  --build-arg BUILDTAG=grpcping \
  --tag "${REPO}/sample/grpc-ping" \
  --file=sample/grpc-ping/Dockerfile .
docker push "${REPO}/sample/grpc-ping"

# Replace the image reference with our published image.
perl -pi -e "s@github.com/knative/serving/sample/grpc-ping@${REPO}/sample/grpc-ping@g" sample/grpc-ping/*.yaml

# Deploy the Knative sample
kubectl apply -f sample/grpc-ping/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 -o jsonpath="{.status.domain}"`

# Put the ingress IP into an environment variable.
export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
  1. Use the client to send message streams to the gRPC server
go run -tags=grpcping sample/grpc-ping/client/client.go -server_addr="$SERVICE_IP:80" -server_host_override="$SERVICE_HOST"