Lifecycle
io.k8s.api.core.v1.Lifecycle
source ↗
Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.
postStartLifecycleHandlerPostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes.More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks
execExecActionExec specifies a command to execute in the container.
command[]stringCommand is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.httpGetHTTPGetActionHTTPGet specifies an HTTP GET request to perform.
hoststringHost name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.httpHeaders[]HTTPHeaderCustom headers to set in the request. HTTP allows repeated headers.
namestring requiredThe header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header.valuestring requiredThe header field valuepathstringPath to access on the HTTP server.portIntOrString requiredName or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.schemestringScheme to use for connecting to the host. Defaults to HTTP.sleepSleepActionSleep represents a duration that the container should sleep.
secondsinteger (int64) requiredSeconds is the number of seconds to sleep.tcpSocketTCPSocketActionDeprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for backward compatibility. There is no validation of this field and lifecycle hooks will fail at runtime when it is specified.
hoststringOptional: Host name to connect to, defaults to the pod IP.portIntOrString requiredNumber or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.preStopLifecycleHandlerPreStop is called immediately before a container is terminated due to an API request or management event such as liveness/startup probe failure, preemption, resource contention, etc. The handler is not called if the container crashes or exits. The Pod's termination grace period countdown begins before the PreStop hook is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period (unless delayed by finalizers). Other management of the container blocks until the hook completes or until the termination grace period is reached.More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks
execExecActionExec specifies a command to execute in the container.
command[]stringCommand is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.httpGetHTTPGetActionHTTPGet specifies an HTTP GET request to perform.
hoststringHost name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.httpHeaders[]HTTPHeaderCustom headers to set in the request. HTTP allows repeated headers.
namestring requiredThe header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header.valuestring requiredThe header field valuepathstringPath to access on the HTTP server.portIntOrString requiredName or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.schemestringScheme to use for connecting to the host. Defaults to HTTP.sleepSleepActionSleep represents a duration that the container should sleep.
secondsinteger (int64) requiredSeconds is the number of seconds to sleep.tcpSocketTCPSocketActionDeprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for backward compatibility. There is no validation of this field and lifecycle hooks will fail at runtime when it is specified.
hoststringOptional: Host name to connect to, defaults to the pod IP.portIntOrString requiredNumber or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.stopSignalstringStopSignal defines which signal will be sent to a container when it is being stopped. If not specified, the default is defined by the container runtime in use. StopSignal can only be set for Pods with a non-empty .spec.os.name