Hacker News new | ask | show | jobs
by jeffbee 1622 days ago
grep and other shell tool one-liners also make excellent kubernetes liveness checks. I have some kubernetes daemonsets that don't do anything other than assert that things on the node are as they should, via grep exit status.
1 comments

It's also useful for alternative health check commands depending on which environment you're in.

For example you could configure a Docker Compose health check to curl an endpoint for a 200 in production but in development override the health check command to call /bin/true so you don't get log spam in development from your health check while ensuring the health check still passes since /bin/true is an extremely minimal command that returns an exit code of 0. This can be controlled by a single environment variable too, no changes needed to your docker-compose.yml file.

I covered this pattern in a recent DockerCon talk at https://nickjanetakis.com/blog/best-practices-around-product....