[쿠버네티스] 7. Job & CronJob

Job

basic template

apiVersion: batch/v1
kind: Job
metadata:
	name: math-add-job
spec:
	template:
		spec:
			containers:
			- name: math-add
				image: ubuntu
				command: ['expr','3','+','2']
			restartPolicy: Never

 

 

multiple pods

apiVersion: batch/v1
kind: Job
metadata:
	name: math-add-job
spec:
	completions: 3 // Until successful count
	template:
		spec:
			containers:
			- name: math-add
				image: ubuntu
				command: ['expr','3','+','2']
			restartPolicy: Never

 

Parallelism

apiVersion: batch/v1
kind: Job
metadata:
	name: math-add-job
spec:
	completions: 3 // Until successful count
	parallelism: 3 // Create pod at once
	template:
		spec:
			containers:
			- name: math-add
				image: ubuntu
				command: ['expr','3','+','2']
			restartPolicy: Never

 

CronJob

*      *      *      *      *
분(0-59)  시간(0-23)  일(1-31)  월(1-12)   요일(0-7)

 

basic template

apiVersion: batch/v1beta1
kind: CronJob
metadata:
	name: reporting-cron-job
spec:
	schedule: "*/1 * * * *"
  jobTemplate:
		spec:
			completions: 3 // Until successful count
			parallelism: 3 // Create pod at once
			template:
				spec:
					containers:
					- name: math-add
						image: ubuntu
						command: ['expr','3','+','2']
					restartPolicy: Never

 

 

 

댓글

Designed by JB FACTORY