What is the default behaviour on GCP Kubernetes for Spring Boot applications when
System.exit(1)
is called? Will kubernetes recreate the container? If no - how can i force recreation if my application crashes?
-Alex
On exit code for application kubernetes will restart the container inside the POD and pod state will change to in Ready
column.
if you want to terminate pod gracefully you can have a look at this : https://dzone.com/articles/gracefully-shutting-down-java-in-containers
Terminated: Indicates that the container completed its execution and has stopped running. A container enters into this when it has successfully completed execution or when it has failed for some reason. Regardless, a reason and exit code is displayed, as well as the container’s start and finish time. Before a container enters into Terminated, preStop hook (if any) is executed.
...
State: Terminated
Reason: Completed
Exit Code: 0
Started: Wed, 30 Jan 2019 11:45:26 +0530
Finished: Wed, 30 Jan 2019 11:45:26 +0530
...
Please have a look at kubernetes official doc : https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/