创建一个job
job是k8s的名字空间级别的资源,通过创建pod来管理container,一般用来执行批处理任务
template.spec.restartPolicy
代表job的重启策略,这里是从不重启,即job启动的pod失败之后也不会重新启动
apiVersion: batch/v1
kind: Job
metadata:
name: pi
namespace: stream
labels:
app: pi
spec:
template:
metadata:
name: pi
spec:
containers:
- name: pi
image: hello-world
imagePullPolicy: IfNotPresent
command: ["echo", "Hello world!"]
restartPolicy: Never