Countdown Job in Kubernetes Kodekloud


Question: The Nautilus DevOps team is working on to create few jobs in Kubernetes cluster. They might come up with some real scripts/commands to use, but for now they are preparing the templates and testing the jobs with dummy commands. Please create a job template as per details given below:

    Create a job countdown-devops.

    The spec template should be named as countdown-devops (under metadata), and the container should be named as container-countdown-devops

    Use image ubuntu with latest tag only and remember to mention tag i.e ubuntu:latest, and restart policy should be Never.

    Use command for i in ten nine eight seven six five four three two one ; do echo $i ; done

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.


Create a job.yml

vi job.yml

apiVersion: batch/v1
kind: Job
  name: countdown-devops
      name: countdown-devops
        - name: container-countdown-devops
          image: ubuntu:latest
          command: ["/bin/sh", "-c"]
              "for i in ten nine eight seven six five four three two one ; do echo $i ; done",
      restartPolicy: Never 

Finally apply it

kubectl apply -f job.yml 

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment


Post a Comment