Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Spring JPA
- spring
- cd
- entity graph
- QueryDSL
- producer
- API
- spring kafka
- Entity
- transactionaleventlistener
- Streams
- topic생성
- JPA
- mirror maker2
- AWS
- centos7
- Spring Data JPA
- K8s
- consumer
- ECS
- Kotlin
- PAGING
- kafka
- CI
- CodePipeline
- bean
- Kubernetes
- git
- mysql
- offsetdatetime
Archives
- Today
- Total
Yebali
Kubernetes의 Job, CronJob 본문
Job
Job은 설정한 작업이 정상적으로 완료되면 종료되고, 비정상적으로 끝나면 다시 실행하는 Pod들을 관리한다.
Job을 사용하면 여러 Pod들을 병렬로 실행할 수도 있다.
apiVersion: batch/v1
kind: Job
metadata:
name: centos-job
spec:
completions: 5 # 실행할 Pod의 수
parallelism: 2 # 동시에 실행되는 Pod 수
activeDeadlineSeconds: 15 # 작업에 대한 데드라인
template:
spec:
containers:
- name: centos-container
image: centos:7
command: ["bash"]
args:
- "-c"
- "echo 'Hello World'; sleep 5; echo 'Bye'"
restartPolicy: Never
CronJob
CronJob은 설정한 주기에 따라 주기적을 반복하는 Job을 만든다.
CronJon의 시간은 kube-controller-manager의 시간대를 기준으로 한다.
apiVersion: batch/v1
kind: CronJob
metadata:
name: cronjob-exam
spec:
schedule: "* * * * *" // 반복주기
startingDeadlineSeconds: 300
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- echo Hello; sleep 10; echo Bye
restartPolicy: Never
'Backend Common' 카테고리의 다른 글
Kubernetes의 kube-proxy (0) | 2024.03.04 |
---|---|
Kubernetes의 Service (0) | 2024.03.03 |
Kubernetes의 Pod와 Controller (0) | 2024.03.03 |
Kubernetes의 Control Plane와 Node, Namespace (0) | 2024.03.03 |
k8s 환경에서 pinpoint 적용하기 (feat. NCP) (1) | 2023.12.31 |