<p>Kubernetes provides a <code>activeDeadlineSeconds</code> field for both <code>JobSpec</code> and <code>PodSpec</code></p>

<p>What is the difference between the two? I've put together a little job with <code>activeDeadlineSeconds</code> set to 20, and in its Pod definition I have set the <code>activeDeadlineSeconds</code> field to 45. These are kind of arbitrary but meant to be spaced out. When I create/apply the Job then run <code>kubectl get pods -a --watch</code>, I can see that the 20 deadline isn't having any effect but the second one is (I see the <code>DeadlineExceeded</code> output).</p>

<p>Just to be extra certain, I added <code>terminationGracePeriodSeconds: 10</code> in the PodSpec and see the same thing.</p>

<p>What is the purpose of the <code>activeDeadlineSeconds</code> in the Job? It doesn't seem to be sending any signal to my container.</p>

<p>Note: I'm simply running the <code>sleep</code> command on an <code>ubuntu</code> image. This command should exit when receiving the TERM signal sent by Kubernetes (so I expect a TERM signal at 20 seconds then the pod to die shortly thereafter)</p>

<p>Condensed YAML definition:</p>

<pre><code>apiVersion: batch/v2alpha1  # K8s 1.7.x
kind: CronJob
spec:
  schedule: "*/1 * * * *"
  concurrencyPolicy: Allow
  jobTemplate:
    spec:  # JobSpec
      activeDeadlineSeconds: 20   # This needs to be shorter than the cron interval  ## TODO - NOT WORKING!
      parallelism: 1
      template:  # PodTemplateSpec
        spec:
          activeDeadlineSeconds: 45
          terminationGracePeriodSeconds: 10
          containers:
          - name: ubuntu-container
            image: ubuntu
            command: ['bash', '-c', 'sleep 500000']
</code></pre>

<p>References: </p>

<ul>
<li><a href="https://v1-7.docs.kubernetes.io/docs/api-reference/v1.7/#jobspec-v1-batch" rel="noreferrer">https://v1-7.docs.kubernetes.io/docs/api-reference/v1.7/#jobspec-v1-batch</a></li>
<li><a href="https://v1-7.docs.kubernetes.io/docs/api-reference/v1.7/#podspec-v1-core" rel="noreferrer">https://v1-7.docs.kubernetes.io/docs/api-reference/v1.7/#podspec-v1-core</a></li>
<li><a href="https://unix.stackexchange.com/questions/429594/why-sigterm-is-able-to-kill-sleep">https://unix.stackexchange.com/questions/429594/why-sigterm-is-able-to-kill-sleep</a> </li>
</ul>

s g
<p>Community wiki answer for future:</p>

<p>As per @Clorichel this issue was fixed in k8s v1.8
<a href="https://github.com/kubernetes/kubernetes/issues/32149" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/32149</a></p>

<p>My advice is to upgrade your cluster to the latest version, if is possible to have access to newest features and bug fixes.</p>
