kubernetes --- Init-Container

For activating one or more "init" container before starting the application container, the preset condition required to complete an application container. init application on the container and the container is essentially the same, but they are run only once on the end of the task, and must be completed after the successful implementation of the system in order to proceed to the next container. The restart policy pod when init container fails, provided the RestartPolicy = Never, pod will fail to launch automatically; when provided RestartPolicy = Always, Pod restart the system will be automatically

init difference between container and container applications

Simply explain the difference between the two:

  • init mode of operation of container and containers of different applications, they must be completed prior to the implementation of the application container, when setting up multiple init container, run one by one in sequence, and only after the previous init container in order to run a successful run init container. When all init container run successfully, kubernetes will initialize the pod of a variety of information, and start creating and running the application container.
  • In the definition of init container can also be set resource limits, volume of use and security policies, and so on. However, resource constraints and application containers of different settings:
    • If the init container defines a plurality of resource request / resource limit, taking the maximum value as the value for all resource requests to container init / resource limit value.
    • The effective value of the resource request of the pod / resource limit value, whichever is greater of the following two:
      • Resource request values ​​of all the application container / limit values ​​and
      • init container valid resource request value / limit value
    • Scheduling algorithm based on the resource request pod valid value / limit value is calculated, i.e. init container may be an initialization operation to reserve system resources, even when the container without the use of subsequent application of these resources.
    • pod effective QoS ratings apply to init container and container applications.
    • Resource quotas and limits the resource request based on the effective pod / limitations, consistent with the scheduling mechanism.
  • init container can not be set readinessProbe probe, because of the need to continue to run an ordinary container defined in the pod after their successful run. When the pod will restart, init container will be re-run, common pod restart scenario is as follows:
    • init container when the image is updated, init container will be re-run, leading pod restart, only updates the application container mirroring only make application container is restarted.
    • When the pod container of infrastructure update, pod will restart.
    • Container or pod in all applications are terminated, and when RestartPolicy = Always, then the pod will restart.

 

Guess you like

Origin www.cnblogs.com/li-tian-jun/p/11414034.html