Sample Kubernetes Cron Job code

cron jobs kubernetes


############ kube JOBS #########################

apiVersion: batch/v1

kind: Job

metadata:

  name: pi

spec:

  template:

    spec:

      containers:

      - name: pi

        image: perl

        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]

      restartPolicy: Never

  backoffLimit: 4
###########################################################

apiVersion: batch/v1

kind: Job

metadata:

name: consumer

spec:

completions: 5

template:

  metadata:

    name: consumer

  spec:

    containers:

    - name: consumer

      image: busybox

      command: ["/bin/sh","-c"]

      args: ["echo 'consuming a message'; sleep 5"]

    restartPolicy: OnFailure

#######################################################

apiVersion: batch/v1

kind: Job

metadata:

  name: twitter-consumer

spec:

  backoffLimit: 5

  activeDeadlineSeconds: 20

  template:

                spec:

                  containers:

                  - name: consumer

                    image: busybox

                    command: ["/bin/sh", "-c"]

                    args: ["echo 'Consuming data'; sleep 1; exit 1"]

                  restartPolicy: OnFailure

Comments

Popular posts from this blog

Push command for NetWorker Client Upgrade

Factors Affecting Users’ Sense of Security and Trust in Integrating Electronic health record to the cloud

Basic Elastic Cloud Storage Troubleshooting Commands