k8s中job和cronjob相关的yaml文件

job

apiVersion: batch/v1
kind: Job
metadata:
  creationTimestamp: null
  name: pi
spec:
  template:
    metadata:
      creationTimestamp: null
    spec:
      containers:
      - image: perl
        name: pi
        command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
  backoffLimit: 4

cronjob

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  creationTimestamp: null
  name: hello
spec:
  jobTemplate:
    metadata:
      creationTimestamp: null
      name: hello
    spec:
      template:
        metadata:
          creationTimestamp: null
        spec:
          containers:
          - command:
            - /bin/sh
            - -c
            - date; echo Hello from the kubernets cluster
            image: busybox
            name: hello
            resources: {}
          restartPolicy: OnFailure
  schedule: '*/1 * * * *'
status: {}
posted @ 2020-12-15 15:02  Richardo-M-Lu  阅读(611)  评论(0编辑  收藏  举报