Is it possible to set readiness and liveliness probes from the program?

7/14/2018

I'm new to Kubenetes, and would like to clarify the following.

Assume we have a containerized java program (using docker) running in k8s. I need to stop getting requests to a pod when the heap size consumed by JVM reaches a limit. For that can I set the readiness and liveliness probes to certain values, so that I want get further requests to that pod? If so how can I set those values?

Thank you

-- Pasindu Tennage
docker
java
kubernetes

1 Answer

7/14/2018

Yes this is possible. K8s livinessProbes can be a command.

for instances.

livenessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - /home/test/check.sh

If you then write a script that checks the used heap by the JVM you should have the probe that you want.

-- Gerben
Source: StackOverflow