All Projects → grpc-ecosystem → Grpc Health Probe

grpc-ecosystem / Grpc Health Probe

Licence: apache-2.0
A command-line tool to perform health-checks for gRPC applications in Kubernetes etc.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Grpc Health Probe

Prototool
Your Swiss Army Knife for Protocol Buffers
Stars: ✭ 4,932 (+622.11%)
Mutual labels:  grpc
Kafka Pixy
gRPC/REST proxy for Kafka
Stars: ✭ 613 (-10.25%)
Mutual labels:  grpc
Rpcx
Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱!
Stars: ✭ 6,516 (+854.03%)
Mutual labels:  grpc
Chatengine
Open source mtproto server written in golang with compatible telegram client
Stars: ✭ 544 (-20.35%)
Mutual labels:  grpc
Proteus
Generate .proto files from Go source code.
Stars: ✭ 593 (-13.18%)
Mutual labels:  grpc
Grpclib
Pure-Python gRPC implementation for asyncio
Stars: ✭ 615 (-9.96%)
Mutual labels:  grpc
Swell
Swell: API development tool that enables developers to test endpoints served over streaming technologies including Server-Sent Events (SSE), WebSockets, HTTP2, GraphQL, and gRPC.
Stars: ✭ 517 (-24.3%)
Mutual labels:  grpc
Jboot
一个优雅的微服务框架,SpringCloud 之外的另一个选择,已经使用在用户量过亿的商业产品上,有超过1000家公司在使用Jboot做极速开发...
Stars: ✭ 655 (-4.1%)
Mutual labels:  grpc
Gubernator
High Performance Rate Limiting MicroService and Library
Stars: ✭ 609 (-10.83%)
Mutual labels:  grpc
Bloomrpc
GUI Client for GRPC Services
Stars: ✭ 7,144 (+945.97%)
Mutual labels:  grpc
Centrifugo
Scalable real-time messaging server in a language-agnostic way. Set up once and forever.
Stars: ✭ 5,649 (+727.09%)
Mutual labels:  grpc
Grpc Proxy
gRPC proxy is a Go reverse proxy that allows for rich routing of gRPC calls with minimum overhead.
Stars: ✭ 571 (-16.4%)
Mutual labels:  grpc
Familybucket
集合.net core、ocelot、consul、netty、rpc、eventbus、configserver、tracing、sqlsugar、vue-admin、基础管理平台等构建的微服务一条龙应用
Stars: ✭ 629 (-7.91%)
Mutual labels:  grpc
Multi V2ray
v2ray/xray多用户管理部署程序
Stars: ✭ 5,382 (+687.99%)
Mutual labels:  grpc
Brpc Java
Java implementation for Baidu RPC, multi-protocol & high performance RPC.
Stars: ✭ 647 (-5.27%)
Mutual labels:  grpc
Grpc Dart
The Dart language implementation of gRPC.
Stars: ✭ 518 (-24.16%)
Mutual labels:  grpc
Chat
Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
Stars: ✭ 8,238 (+1106.15%)
Mutual labels:  grpc
Servicetalk
A networking framework that evolves with your application
Stars: ✭ 656 (-3.95%)
Mutual labels:  grpc
Protoreflect
Reflection (Rich Descriptors) for Go Protocol Buffers
Stars: ✭ 651 (-4.69%)
Mutual labels:  grpc
Practical.cleanarchitecture
Asp.Net Core 5 Clean Architecture (Microservices, Modular Monolith, Monolith) samples (+Blazor, Angular 11, React 17, Vue 2.6), Domain-Driven Design, CQRS, Event Sourcing, SOLID, Asp.Net Core Identity Custom Storage, Identity Server 4 Admin UI, Entity Framework Core, Selenium E2E Testing, SignalR Notification, Hangfire Tasks Scheduling, Health Checks, Security Headers, ...
Stars: ✭ 639 (-6.44%)
Mutual labels:  grpc

grpc_health_probe(1)

ci GitHub all releases

The grpc_health_probe utility allows you to query health of gRPC services that expose service their status through the gRPC Health Checking Protocol.

This command-line utility makes a RPC to /grpc.health.v1.Health/Check. If it responds with a SERVING status, the grpc_health_probe will exit with success, otherwise it will exit with a non-zero exit code (documented below).

grpc_health_probe is meant to be used for health checking gRPC applications in Kubernetes, using the exec probes.

EXAMPLES

$ grpc_health_probe -addr=localhost:5000
healthy: SERVING
$ grpc_health_probe -addr=localhost:9999 -connect-timeout 250ms -rpc-timeout 100ms
failed to connect service at "localhost:9999": context deadline exceeded
exit status 2

Installation

It is recommended to use a version-stamped binary distribution:

  • Choose a binary from the Releases page.

Installing from source (not recommended):

  • Make sure you have git and go installed.
  • Run: go get github.com/grpc-ecosystem/grpc-health-probe
  • This will compile the binary into your $GOPATH/bin (or $HOME/go/bin).

Using the gRPC Health Checking Protocol

To make use of the grpc_health_probe, your application must implement the gRPC Health Checking Protocol v1. This means you must to register the Health service and implement the rpc Check that returns a SERVING status.

Since the Health Checking protocol is part of the gRPC core, it has packages/libraries available for the languages supported by gRPC:

[health.proto] [Go] [Java] [Python] [C#/NuGet] [Ruby] ...

Most of the languages listed above provide helper functions that hides implementation details. This eliminates the need for you to implement the Check rpc yourself.

Example: gRPC health checking on Kubernetes

Kubernetes does not natively support gRPC health checking since it does not favor one RPC framework over another. Similarly, HTTP health probes Kubernetes has is not sufficient to craft a valid gRPC request. As a solution, grpc_health_probe can be used for Kubernetes to health-check gRPC servers running in the Pod.

You are recommended to use Kubernetes exec probes and define liveness and/or readiness checks for your gRPC server pods.

You can bundle the statically compiled grpc_health_probe in your container image. Choose a binary release and download it in your Dockerfile:

RUN GRPC_HEALTH_PROBE_VERSION=v0.3.1 && \
    wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
    chmod +x /bin/grpc_health_probe

In your Kubernetes Pod specification manifest, specify a livenessProbe and/or readinessProbe for the container:

spec:
  containers:
  - name: server
    image: "[YOUR-DOCKER-IMAGE]"
    ports:
    - containerPort: 5000
    readinessProbe:
      exec:
        command: ["/bin/grpc_health_probe", "-addr=:5000"]
      initialDelaySeconds: 5
    livenessProbe:
      exec:
        command: ["/bin/grpc_health_probe", "-addr=:5000"]
      initialDelaySeconds: 10

This approach provide proper readiness/liveness checking to your applications that implement the gRPC Health Checking Protocol.

Health Checking TLS Servers

If a gRPC server is serving traffic over TLS, or uses TLS client authentication to authorize clients, you can still use grpc_health_probe to check health with command-line options:

Option Description
-tls use TLS (default: false)
-tls-ca-cert path to file containing CA certificates (to override system root CAs)
-tls-client-cert client certificate for authenticating to the server
-tls-client-key private key for for authenticating to the server
-tls-no-verify use TLS, but do not verify the certificate presented by the server (INSECURE) (default: false)
-tls-server-name override the hostname used to verify the server certificate

Other Available Flags

Option Description
-v verbose logs (default: false)
-connect-timeout timeout for establishing connection
-rpc-timeout timeout for health check rpc
-user-agent user-agent header value of health check requests (default: grpc_health_probe)
-service service name to check (default: "") - empty string is convention for server health
-gzip use GZIPCompressor for requests and GZIPDecompressor for response (default: false)

Example:

  1. Start the route_guide example server with TLS by running:

    go run server/server.go -tls
    
  2. Run grpc_client_probe with the CA certificate (in the testdata/ directory) and hostname override the cert is signed for:

    $ grpc_health_probe -addr 127.0.0.1:10000 \
        -tls \
        -tls-ca-cert /path/to/testdata/ca.pem \
        -tls-server-name=x.test.youtube.com
    
    status: SERVING
    

Exit codes

It is not recommended to rely on specific exit statuses. Any failure will be a non-zero exit code.

Exit Code Description
0 success: rpc response is SERVING.
1 failure: invalid command-line arguments
2 failure: connection failed or timed out
3 failure: rpc failed or timed out
4 failure: rpc successful, but the response is not SERVING

This is not an official Google project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].