init container

A container in a pod that must run to completion before the main containers start, used for one-off setup such as waiting for a dependency.

In more detail

Init containers run one at a time in the order listed, and if one fails the kubelet retries it according to the restart policy. While they run the pod shows an Init status. They share the pod's volumes, so they can prepare files for the application.

Example

initContainers:
  - name: first
    image: busybox:1.37
    command: ["sh", "-c", "sleep 20"]

Related terms

Taught in

References

Certification courses