Schedule a batch/v1 Job onto preemptible machine type

Cluster information:

Kubernetes version: 1.13.7-gke.8
Cloud being used: GKE

Basic Job yaml:

apiVersion: batch/v1
kind: Job
  name: pyversion
      - name: python37
        image: python:3.7
        command: ["python", "--version"]
      restartPolicy: Never
  backoffLimit: 4

How can I choose to place this job preferentially onto preemptible nodes? I have tried nodeSelector, selector, and affinity without success; it looks like several of those are not available for “Job” type.

Thanks in advance.

can it be applied to the spec inside template?

Can you share what you tried?

The job includes the pod spec that has all these fields, so you should be able to just use them.

See the reference documentation with the details about all the fields: you can see it includes the pod spec and that the pod spec includes those fields.

You can see that (if I don’t copy incorrectly) in spec.template it is a pod spec.

So, you should be able to use nodeSelectors at that indentation level.

Can you double check you are using those fields at right indentation level?

1 Like