grpcping

command module
v0.0.0-...-e051335 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2018 License: MIT Imports: 8 Imported by: 0

README

Simple tool to check if the server is running

It used to be hard to talk to grpc endpoint from a command line, now it's easy.

How to setup a server

Add a health check:

import (
  	"google.golang.org/grpc/health"
	healthpb "google.golang.org/grpc/health/grpc_health_v1"
)

    // ...

	healthsrv := health.NewServer()
	healthpb.RegisterHealthServer(srv, healthsrv)
	healthsrv.SetServingStatus(serviceName, healthpb.HealthCheckResponse_SERVING)

How to use a client

If you do it locally, first, forward a port:

kubectl port-forward POD_NAME 8080:8080

Then run:

grpcping -address "localhost:8080" -service SERVICE_NAME

where SERVICE_NAME is serviceName at the server side.

Using grpcping in a pod
make
kubectl cp grpcping POD_NAME:/bin/grpcping
kubectl exec -it POD_NAME /bin/sh
chown root:root /bin/grpcping && chmod a+x /bin/grpcping && grpcping -help
grpcping -address ADDRESS -service SERVICE_NAME

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL