Search code examples
kubernetesjobs

Kubernetes Jobs backOffLimit


enter image description here

Is this diagram correct? Because, activeDeadlineSeconds takes precedence over backOffLimit, if activeDeadlineSeconds exceeded it should directly mark the job as incomplete right? Why is this checking backOffLimit if activeDeadlineSeconds exceeded?


Solution

  • The two parameters serve different purposes. In most cases ActiveDeadlineSeconds takes precedence over backoffLimit because activedeadline is a hard limit on the amount of time that an operation is allowed to take. If activeDeadlineSeconds exceeds then all the pods will terminate and mark the job as failure with reason: DeadlineExceeded. Whereas the backofflimit is a limit on the number of tries that are attempted. However the specific precedence will depend on the implementation of the API or application system, as different systems may prioritize these parameters differently.

    The scheduling of cronjobs will be as follows

    1. On scheduling a cron job.
    2. It will create a normal job.
    3. Job will create a Pod.
    4. If Pod has Error it will check whether the backoffLimit is exceeded or not.
    5. If Yes, then it will mark the job as incomplete.
    6. If No, then it will check if the activeDeadlineSeconds exceeded or not.
    7. If activeDeadlineSeconds does not exceed then the job is marked as complete.
    8. If it is exceeded then it will mark as failure with reason DeadlineExceeded.

    For more information refer to this official k8 document