How Pods Are Counted for Billing
Understanding which pod conditions are billed and which are not, based on real-time Kubernetes event tracking.
How Billing Works
Per-Pod Time-Based Billing
Billing dihitung setiap 5 menit. Setiap pod di-charge berdasarkan waktu running sebenarnya.
charge_per_session = floor(elapsed_minutes) × (package_price_per_hour ÷ 60) Untuk setiap session aktif, hitung elapsed sejak last_billed_at, bulatkan ke bawah, kalikan harga per menit.
Every 5 Minutes
Billing runs at minute 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 (WIB).
1 Pod = 1 Session
Each tracked pod gets one open session. Duplicate sessions are prevented. Each session tracks last_billed_at.
Per-Minute Accuracy
Each session charges based on floor(elapsed_minutes). Short-lived pods are not overcharged.
Billable Pods
These pod conditions count toward your billing. Each open session contributes to the active billable pod count.
| Pod Condition | Status |
|---|---|
| Running | BILLABLE |
| Running + Terminating | BILLABLE_TERMINATING |
| CrashLoopBackOff | RESERVATION |
| OOMKilled | RESERVATION |
| Terminating + Containers Running | BILLABLE_TERMINATING |
| Unknown Waiting State | RESERVATION |
Not Billable
These pod conditions do not count toward billing. Sessions are closed or never created.
| Pod Condition | Status |
|---|---|
PendingPodInitializingContainerCreating | FREE |
ImagePullBackOff | FREE |
InvalidImageName | FREE |
CreateContainerConfigError | FREE |
Unknown Phase | FREE |
Pod Deleted | FREE |
Terminating + Containers Stopped | FREE |
No Application ID | FREE |
Session Lifecycle & Final Charge
Each pod gets one billing session. Every 5 minutes, session is charged based on elapsed time since last_billed_at. When pod is deleted, final charge applies remaining minutes (rounded up).
| Event | Status |
|---|---|
| Pod Added | BILLABLE |
| Every 5 min (Billing Tick) | BILLABLE |
| CrashLoopBackOff | RESERVATION |
| Platform Error | FREE |
| Pod Deleted (HPA kill / manual) | FREE |
| Stale Session Cleanup | FREE |
Per-Pod Time-Based Calculation
Periodic Billing (every 5 min)
elapsed = now - last_billed_at → billable_min = floor(elapsed_minutes)
Update last_billed_at
After each charge, last_billed_at = now so next tick only charges new elapsed time.
Final Charge (pod deleted)
elapsed = now - last_billed_at → final_min = ceil(elapsed_minutes) (bulatkan ke atas untuk coverage penuh)
Contoh Perhitungan per Skenario
| Skenario | Periodic Tick (floor) | Final Charge (ceil) | Total |
|---|---|---|---|
| Pod hidup 3 mnt, lalu mati | 0 (tidak ada tick) | ceil(3) = 3 mnt | 3 menit |
| Pod hidup 3.7 mnt, lalu mati | floor(3.7) = 3 mnt | ceil(3.7) = 4 mnt | 4 menit |
| Pod hidup 5 mnt pas, lalu mati | floor(5) = 5 mnt | ceil(0) = 0 mnt | 5 menit |
| Pod hidup 8 mnt, lalu mati | floor(5) = 5 mnt | ceil(3) = 3 mnt | 8 menit |
| Pod hidup 17.5 mnt, lalu mati | floor(5) × 3 = 15 mnt | ceil(2.5) = 3 mnt | 18 menit |
Kenapa floor + ceil? Floor di periodic tick memastikan pod tidak di-charge untuk menit awal sebelum tick pertama. Jika pod mati sebelum tick kedua, final charge dengan ceil mengambil semua sisa menit. Kombinasi ini memastikan tidak ada menit yang hilang meskipun pod mati di antara dua tick.
Quick Reference
$ Billable — Session Counted
✕ Not Billable — Session Free
Per-Pod Time-Based Billing
Setiap pod di-charge berdasarkan waktu running sebenarnya. Setiap 5 menit, elapsed sejak last_billed_at di-floor dan di-charge per menit. Saat pod dihapus, sisa waktu di-charge dengan ceil (bulatkan ke atas). Ini lebih akurat dan adil untuk user dan platform.