Skip to content

A minimal, high performance, memory-friendly, safe implementation of the gRPC health checking protocol

License

Notifications You must be signed in to change notification settings

paypizza/grpc-health-check

Repository files navigation

grpc-health-check

grpc-health-check is a minimal, high performance, memory-friendly, safe implementation of the gRPC health checking protocol.

grpc-health-check provides a simple command line that eases the transition from other tools and requires no dependencies. Most grpc-health-check commands can be run as a regular user, without requiring additional privileges.

Exits with a status of 0 (true) or 1 (false), depending on the evaluation of the gRPC health checking protocol status.

CI codecov

Documentation

Usage

$ grpc-health-check [FLAGS] [OPTIONS]

Example

$ grpc-health-check --port 5400

Installation

Kubernetes

spec:
  containers:
  - name: server
    image: ...
    ports:
    - containerPort: 5400
    readinessProbe:
      exec:
        command: ["grpc-health-check", "--port=5400"]
      initialDelaySeconds: 2
    livenessProbe:
      exec:
        command: ["grpc-health-check", "--port=5400"]
      periodSeconds: 1 // Check once every second
      initialDelaySeconds: 4

Linux

Alpine

$ apk add grpc-health-check --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing

Fedora

$ dnf copr enable paypizza/community
$ dnf install grpc-health-check

RHEL/CentOS

$ dnf copr enable paypizza/community
$ dnf install grpc-health-check

Ubuntu

$ add-apt-repository ppa:paypizza/community
$ apt-get install grpc-health-check

openSUSE

$ zypper ar https://copr.fedorainfracloud.org/coprs/paypizza/community/repo/opensuse-leap/
$ zypper in grpc-health-check

Bazel

WORKSPACE

http_archive(
    name = "paypizza_grpc_health_check",
    strip_prefix = "grpc-health-check-bc9752df03de04dc8f1bc23990bb7e10838698b5",
    sha256 = "f6d4fcdd0b67b07193479fe6c6689d9a7540abb5234c3a096b112f43fd5cf03c",
    urls = [
        "https://github.com/paypizza/grpc-health-check/archive/bc9752df03de04dc8f1bc23990bb7e10838698b5.tar.gz",
    ],
)

load(
    "@paypizza_grpc_health_check//:defs.bzl",
    "paypizza_grpc_health_check_crate_repositories",
    "paypizza_grpc_health_check_repositories",
)

paypizza_grpc_health_check_repositories()

paypizza_grpc_health_check_crate_repositories()

BUILD.bazel

load("@io_bazel_rules_docker//container:container.bzl", "container_layer")

container_layer(
    name = "grpc_health_check_container_layer",
    directory = "/usr/bin",
    files = ["@paypizza_grpc_health_check//:binary"],
)

Flags

--help, -h

Prints help information.

--version, -V

Prints version information.

--verbose

Enable verbose mode.

Options

--address=address

Address to the gRPC server (default localhost).

--config=config

File path to the YAML configuration file.

--port=port

Port to the gRPC server.

--rpc-timeout=rpc-timeout

Timeout for establishing connection in milliseconds (ms) (default 1500).

--service-name=service-name

Name of the service to check (default ""). An empty string is the default value, according to the gRPC Health Check Protocol specification.

--stream=true|false

Enable RPC streaming mode (default false).

--tls-ca-cert=tls-ca-cert

File path to the CA certificate against which to verify the server's certificate.

--tls-client-cert=tls-client-cert

File path to the client's certificate.

--tls-client-key=tls-client-key

File path to the client's private key.

--tls-domain-name=tls-domain-name

Name of the domain against which to verify the server's certificate.

--user-agent=user-agent

Name of the user agent.

Configuration

YAML

address: ""
port: integer
rpc_timeout: integer
service_name: ""
stream: true|false
tls_ca_cert: ""
tls_client_cert: ""
tls_client_key: ""
tls_domain_name: ""
user_agent: ""