When I create a job/cronjob it creates a pod eventually to run the job/cronjob. . . .

Chandu:
When I create a job/cronjob it creates a pod eventually to run the job/cronjob. But, where can we see the settings related to the activeDeadlineSeconds in the pod file when we try to get the details of the related pod of a job/cronjob.

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2022-10-14T16:09:43Z"
  generateName: pi-with-timeout-
  labels:
    controller-uid: 18811ee1-7f63-4660-bacb-2971963723af
    job-name: pi-with-timeout
  name: pi-with-timeout-bc78k
  namespace: default
  ownerReferences:
  - apiVersion: batch/v1
    blockOwnerDeletion: true
    controller: true
    kind: Job
    name: pi-with-timeout
    uid: 18811ee1-7f63-4660-bacb-2971963723af
  resourceVersion: "1581684"
  uid: b196807b-c0f2-43c5-86a5-9ec23b36de11
spec:
  containers:
  - command:
    - perl
    - -Mbignum=bpi
    - -wle
    - print bpi(2000)
    image: perl:5.34.0
    imagePullPolicy: IfNotPresent
    name: pi
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-8vb9c
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  nodeName: docker-desktop
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Never
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:
  - effect: NoExecute
    key: <http://node.kubernetes.io/not-ready|node.kubernetes.io/not-ready>
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: <http://node.kubernetes.io/unreachable|node.kubernetes.io/unreachable>
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - name: kube-api-access-8vb9c
    projected:
      defaultMode: 420
      sources:
      - serviceAccountToken:
          expirationSeconds: 3607
          path: token
      - configMap:
          items:
          - key: ca.crt
            path: ca.crt
          name: kube-root-ca.crt
      - downwardAPI:
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2022-10-14T16:09:43Z"
    reason: PodCompleted
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2022-10-14T16:09:52Z"
    reason: PodCompleted
    status: "False"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2022-10-14T16:09:52Z"
    reason: PodCompleted
    status: "False"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2022-10-14T16:09:43Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: <docker://c573299aa358cb5e270588275bbe786bba9f922597045d9e426d58d9652829d>b
    image: perl:5.34.0
    imageID: <docker-pullable://perl@sha256:2584>f46a92d1042b25320131219e5832c5b3e75086dfaaff33e4fda7a9f47d99
    lastState: {}
    name: pi
    ready: false
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: <docker://c573299aa358cb5e270588275bbe786bba9f922597045d9e426d58d9652829d>b
        exitCode: 0
        finishedAt: "2022-10-14T16:09:52Z"
        reason: Completed
        startedAt: "2022-10-14T16:09:44Z"
  hostIP: 192.168.65.4
  phase: Succeeded
  podIP: 10.1.31.34
  podIPs:
  - ip: 10.1.31.34
  qosClass: BestEffort
  startTime: "2022-10-14T16:09:43Z"
apiVersion: batch/v1
kind: Job
metadata:
  name: pi-with-timeout
spec:
  backoffLimit: 5
  activeDeadlineSeconds: 100
  template:
    spec:
      containers:
      - name: pi
        image: perl:5.34.0
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never

Above are both pod and job yaml properties. I created a job using the above properties. In that I mentioned activeDeadlineSeconds . But, I don’t see that in the pod created by the job
Can someone please help me understand it?

unnivkn:
Hi @Chandu fyr:

Chandu:
I don’t think you understand my question fully. In other words my question is: How does a pod know when should it kill itself without the property in the pod manifests file

Chandu:
@unnivkn

unnivkn:
HI @Chandu did you get a chance to go through this?

unnivkn:
Also you may refer deployment section of the ckad course.

Chandu:
Yes. I have gone through it.

Chandu:
I have created a job with activeDeadlineSeconds. Job created a pod. So, when the pod was created by the job the pod spec doesn’t have the option that I have mentioned in the job template.

Chandu:
for activeDeadlineSeconds

Chandu:
How does the pod know to wait 100 sec before to kill it @unnivkn

unnivkn:
Please don’t think pod inside a job as a separate entity… it’s part of the job… The job have full control on it’s pod.