Init là gate trước app
Pod chạy init theo thứ tự; init phải exit 0 thì app containers mới start. Dùng init cho prepare file, wait dependency hoặc migration có kiểm soát. Khi stuck, xem init status/reason, events và logs đúng container; app logs rỗng là expected nếu app chưa được start.
Dependency và repeatability
Wait loop cần timeout/backoff và signal lỗi; kiểm tra Service/DNS/port từ init context. Shared emptyDir chỉ truyền file, không biến dependency thành healthy. Migration phải idempotent hoặc có lock/rollback; restart Pod có thể chạy init lại.
Bài tập
Tạo dependency mock + init chuẩn bị marker, verify thứ tự, mô phỏng dependency/permission/command failure, sửa và tạo variant restart. Ghi state transition Init:Completed → app Ready và cleanup/data caveat.