All pods are notified via SIGTERM that they should shut down. You can also
register a pre-stop hook in the pod definition that is given a chance to
run before SIGTERM is sent. You must set a longer
terminationGracePeriodSeconds if you need more than the default 30s:
$ oc explain pod.spec.terminationGracePeriodSeconds
FIELD: terminationGracePeriodSeconds <integer>
DESCRIPTION:
Optional duration in seconds the pod needs to terminate gracefully.
May be
decreased in delete request. Value must be non-negative integer. The
value
zero indicates delete immediately. If this value is nil, the default
grace
period will be used instead. The grace period is the duration in
seconds
after the processes running in the pod are sent a termination signal
and the
time when the processes are forcibly halted with a kill signal. Set
this
value longer than the expected cleanup time for your process. Defaults
to 30
seconds.
$ oc explain pod.spec.containers.lifecycle.preStop
RESOURCE: preStop <Object>
DESCRIPTION:
PreStop is called immediately before a container is terminated. The
container is terminated after the handler completes. The reason for
termination is passed to the handler. Regardless of the outcome of the
handler, the container is eventually terminated. Other management of
the
container blocks until the hook completes. More info: http://
releases.k8s.io/release-1.4/docs/user-guide/
container-environment.md#hook-details/
Handler defines a specific action that should be taken
FIELDS:
tcpSocket <Object>
TCPSocket specifies an action involving a TCP port. TCP hooks not yet
supported
exec <Object>
One and only one of the following should be specified. Exec specifies
the
action to take.
httpGet <Object>
HTTPGet specifies the http request to perform.
Note that "other management of he container blocks until the hook
completes" means other actions taken by kube against the pod. The grace
period still applies (you will be terminated after that duration).
On Wed, Sep 7, 2016 at 9:54 PM, Frank Liauw <[email protected]> wrote:
> Hi,
>
> I have a microservice that needs to be signalled before disposal (from say
> rolling deployments) so that it can shutdown gracefully.
>
> Is there a way to signal a pod that's impending for shutdown?
>
> Cheers
>
> Frank
> Systems Engineer
>
> VSee: [email protected] <http://vsee.com/u/tmd4RB> | Cell: +65 9338 0035
>
> Join me on VSee for Free <http://vsee.com/u/tmd4RB>
>
>
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>
>
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users