View Source KubernetesHealthCheck.Plug (kubernetes_health_check v0.1.0)

Plug to return health check results.

It calls the app module which does the actual checking.

Following is an example Kubernetes deployment yaml configuration:

startupProbe:
  httpGet:
    path: /healthz/startup
    port: http
  periodSeconds: 3
  failureThreshold: 5

livenessProbe:
  httpGet:
    path: /healthz/liveness
    port: http
  periodSeconds: 10
  failureThreshold: 6

readinessProbe:
  httpGet:
    path: /healthz/readiness
    port: http
  periodSeconds: 10
  failureThreshold: 1

Installation

Add the plug to your endpoint or router. It whould normally be placed above the logger to avoid noise in your logs from health checks.

plug KubernetesHealthCheck.Plug,
  mod: Example.Health,
  base_path: "/healthz"

Init Options

  • :mod - Callback module which implements the health checks for the app, default KubernetesHealthCheck
  • :base_path - Base request_path for health checks, default /healthz
  • :startup_path - Path for startup check, default <base_path>/startup
  • :liveness_path - Path for liveness check, default <base_path>/liveness
  • :readiness_path - Path for readiness check, default <base_path>/readiness

Summary

Functions

call(conn, arg2)

init(opts)