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
- sidecar container — A helper container that runs beside the main container in the same pod, such as a proxy, a log shipper or a file refresher.
- Pod — The smallest unit Kubernetes runs: one or more containers scheduled together on the same machine.
- pod phase — A one-word summary of where a pod is in its life: Pending, Running, Succeeded, Failed or Unknown.
Taught in
- What Argo Workflows Runs: Controller, Server And One Pod A Step — Certified Argo Project Associate (CAPA) Exam Prep
- Artifacts: Files That Outlive The Pod — Certified Argo Project Associate (CAPA) Exam Prep
- Retries, Exit Handlers, Conditions And Deadlines — Certified Argo Project Associate (CAPA) Exam Prep
- What A Container Said Before It Died — Certified Kubernetes Administrator (CKA) Exam Prep
- Four Faults, Twelve Minutes — Certified Kubernetes Administrator (CKA) Exam Prep
- Running, And Still Down — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Sidecars And Init Containers — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Design And Build: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Probes And Health Checks — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Container Logs — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Mock Exam: Sixteen Tasks Against The Clock — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Encrypting Pod-to-Pod Traffic: mTLS With Istio And Cilium — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Allowed Registries: Admission That Refuses Images — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Mock Exam: Seventeen Security Tasks Against The Clock — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Four Alerts, One Incident: Observability And The Mesh — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Troubleshooting: describe, Events And A First Smoke Test — Kubernetes: Production-Grade Container Orchestration
- Pods, Init Containers And Sidecars — Kubernetes: Production-Grade Container Orchestration
References
Certification courses
- CAPA course and practice exam: Certified Argo Project Associate
- CKA course and practice exam: Certified Kubernetes Administrator
- CKAD course and practice exam: Certified Kubernetes Application Developer
- CKS course and practice exam: Certified Kubernetes Security Specialist
- KCSA course and practice exam: Kubernetes and Cloud Native Security Associate