Open linzhengen opened 1 year ago
Job
apiVersion: batch/v1 kind: Job metadata: name: db-migration spec: # 3600s後にジョブが自動に削除される ttlSecondsAfterFinished: 3600 template: metadata: creationTimestamp: null spec: containers: - command: - /bin/sh - -c - migrate db command ... backoffLimit: 0
kubectl waitでjob実行結果を監視
$ kubectl wait --for=condition=complete job/db-migration job.batch/my-job condition met $ echo $? 0
Kustomizeでnamesuffix を付けるとttlSecondsAfterFinished 期限内でも再実行ができる
ttlSecondsAfterFinished
kustomize edit set namesuffix "_"$(date "+%Y%m%d%H%M%S")
DB Migration ジョブの場合
Job
kubectl waitでjob実行結果を監視
Kustomizeでnamesuffix を付けると
ttlSecondsAfterFinished
期限内でも再実行ができる