When a CronJob is deleted, what happens to the associated jobs and pods?

Study for the Kubernetes Cloud Native Associate (KCNA) Certification. Prepare with flashcards and multiple choice questions. Ensure success with detailed explanations. Ready for your exam!

Multiple Choice

When a CronJob is deleted, what happens to the associated jobs and pods?

Explanation:
The key idea is ownership and automatic cleanup. A CronJob creates Jobs, and those Jobs (and the Pods they run) are owned by the CronJob through owner references. When the CronJob is deleted, Kubernetes’ garbage collection removes resources that are owned by it, so the dependent Jobs and the Pods they created are deleted as well. This prevents leftover Jobs from persisting after the CronJob is gone. If you want to keep the Jobs, you’d need to disable cascading deletion or delete them manually.

The key idea is ownership and automatic cleanup. A CronJob creates Jobs, and those Jobs (and the Pods they run) are owned by the CronJob through owner references. When the CronJob is deleted, Kubernetes’ garbage collection removes resources that are owned by it, so the dependent Jobs and the Pods they created are deleted as well. This prevents leftover Jobs from persisting after the CronJob is gone. If you want to keep the Jobs, you’d need to disable cascading deletion or delete them manually.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy