我具有以下Kubernetes作业配置:
---
apiVersion: batch/v1
kind: Job
metadata:
name: dbload
creationTimestamp:
spec:
template:
metadata:
name: dbload
spec:
containers:
- name: dbload
image: sdvl3prox001:7001/pbench/tdload
command: ["/opt/pbench/loadTpcdsData.sh", "qas0063", "dbc", "dbc", "1"]
restartPolicy: Never
imagePullSecrets:
- name: pbenchregkey
status: {}
当我完成kubectl create -f dbload-deployment.yml --record
工作并创建一个pod时,Docker容器运行完毕,并且我得到以下状态:
$ kubectl get job dbload
NAME DESIRED SUCCESSFUL AGE
dbload 1 1 1h
$ kubectl get pods -a
NAME READY STATUS RESTARTS AGE
dbload-0mk0d 0/1 Completed 0 1h
这项工作是一笔交易,我需要能够重新运行它。如果我尝试使用kubectl create
命令此错误
$ kubectl create -f dbload-deployment.yml --record
Error from server: error when creating "dbload-deployment.yml": jobs.batch "dbload" already exists
当然可以kubectl delete job dbload
,然后运行,kubectl create
但是我想知道是否可以以某种方式重新唤醒已经存在的工作?
kubectl replace
在遇到重新创建错误之前删除作业。