Jobs
Jobs are a fundamental resource type in Kubernetes used to run batch processes that run to completion. Unlike long-running services such as web servers, jobs are intended to terminate when the batch process finishes.
A job creates one or more pods that run a defined workload and then terminates when the workload is complete. This is useful for tasks such as data processing, machine learning training, or any finite computation.
To create a job, you define a Job resource in a YAML manifest like this:
job.yaml
apiVersion: batch/v1 kind: Job metadata: name: myjob spec: template: spec: containers: - name: myjob image: busybox command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 30'] ...