Overview
This article describes how to set healthcheck probes for an application.
Healthcheck probes can be useful for preventing the deployment of broken apps to the EYK platform by configuring EYK to only replace pods from the previous release when the pods from a new release report a healthy status.
Information
By default, EYK only checks that the application starts in their Container. A health check may be added by configuring a health check probe for the application. You can list the various health check options by executing eyk healthchecks:set --help
.
The health checks are implemented as Kubernetes Container Probes. A 'liveness' and a 'readiness' probe can be configured, and each probe can be of type 'httpGet', 'exec' or 'tcpSocket' depending on the type of probe the Container requires.
A 'liveness' probe is useful for applications running for long periods of time, eventually transitioning to broken states and cannot recover except by restarting them.
Other times, a 'readiness' probe is useful when the Container is only temporarily unable to serve requests and will recover on its own. In this case, if a Container fails its 'readiness' probe, the Container will not be shut down, but rather the Container will stop receiving incoming requests.
'httpGet' probes are just as it sounds: it performs a HTTP GET operation on the Container. A response code inside the 200-399 range is considered a pass. 'httpGet' probes accept a port number to perform the HTTP GET operation on the Container.
'exec' probes run a command inside the Container to determine its health. An exit code of zero is considered a pass, while a non-zero status code is considered a fail. 'exec' probes accept a string of arguments to be run inside the Container.
'tcpSocket' probes attempt to open a socket in the Container. The Container is only considered healthy if the check can establish a connection. 'tcpSocket' probes accept a port number to perform the socket connection on the Container.
Usage:
eyk healthchecks:set <health-type> <probe-type> [options] [--] <args>...
Arguments:
<health-type> | the healthcheck type, such as 'liveness' or 'readiness'. |
<probe-type> | the healthcheck probe type, such as 'httpGet', 'exec' or 'tcpSocket'. |
<args> | The arguments required for the healthcheck probe. 'exec', accepts a list of arguments; 'httpGet' and 'tcpSocket' accept a port number. |
Options:
-a --app=<app> | the uniquely identifiable name for the application. |
-p --path=<path> | the relative URL path for 'httpGet' probes. [default: /] |
--type=<type> | the procType for which the health check needs to be applied. |
--headers=<headers>... | the HTTP headers to send for 'httpGet' probes, separated by commas. |
--initial-delay-timeout=<initial-delay-timeout> | the initial delay timeout for the probe [default: 50] |
--timeout-seconds=<timeout-seconds> | the number of seconds after which the probe times out [default: 50] |
--period-seconds=<period-seconds> | how often (in seconds) to perform the probe [default: 10] |
--success-threshold=<success-threshold> | minimum consecutive successes for the probe to be considered successful after having failed [default: 1] |
--failure-threshold=<failure-threshold> | minimum consecutive successes for the probe to be considered failed after having succeeded [default: 3] |
Example:
eyk healthchecks:set readiness httpGet 3000 -p /signup --type web |
Comments
Article is closed for comments.