OpenShift Init Container

From NovaOrdis Knowledge Base
Revision as of 01:30, 28 February 2018 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

External

Internal

Overview

An init container is a specialized container that runs before the application containers, and can contain utilities or setup scripts not present in the application image. If a pod declares init containers, the application containers are only run after all init container complete successfully.

An init container always runs to completion, and if more than one init containers are declared, each one is executed sequentially and must complete successfully before the next one is started. This is the reason init containers do not support readiness probes: they must succeed. If an init container fails, Kubernetes will restart the Pod repeatedly until the init container succeeds, unless the pod has a "restartPolicy" of "Never".

Init containers support all the fields and the features of the application containers including resource limits, volumes and security settings. However, the resource requests and limits for an Init Container are handled slightly differently, as described in Resources below.

Declaration

Declared within the context of a pod, under the "initContainers" field.