Showing results for 
Search instead for 
Did you mean: 
Flight Engineer Flight Engineer
Flight Engineer

cronjob.spec.jobTemplate.spec.completions not working in kubernetes


I have a doubt regarding CronJob in Kubernetes. Here I am using completions option in this YAML file under CronJob.spec.jobTemplate.spec and I can see that completions option is not working at all. I thought the job will run 5 times only then it will stopped but the job is continuously running (Please see the logs) so I want know why it is so? CronJob option is accepting completions options then it should work :/

P.S:- Parallelism option is wroking well tough. Also in case of Job.spec.template.spec completions option is working well.


Yaml File:-

kind:     CronJob
apiVersion:  batch/v1beta1
 name: sample-cron-job
 schedule: "*/1 * * * *"
     completions: 5
     parallelism: 2
           - name: cont
             image: alpine
             command: ["/bin/sleep"]
             args: ["180"]
         restartPolicy: Never



NAME                               READY   STATUS      RESTARTS   AGE     IP            NODE       NOMINATED NODE   READINESS GATES         
sample-cron-job-1591543860-72c47   0/1     Completed   0          9m35s   minikube   <none>           <none>         
sample-cron-job-1591543860-dhnfg   0/1     Completed   0          9m27s   minikube   <none>           <none>         
sample-cron-job-1591543860-dxz7f   0/1     Completed   0          12m   minikube   <none>           <none>         
sample-cron-job-1591543860-f4r6g   0/1     Completed   0          12m   minikube   <none>           <none>         
sample-cron-job-1591543860-wjhmk   0/1     Completed   0          5m57s   minikube   <none>           <none>         
sample-cron-job-1591543920-47vk8   0/1     Completed   0          11m   minikube   <none>           <none>         
sample-cron-job-1591543920-4dhnj   0/1     Completed   0          5m19s   minikube   <none>           <none>         
sample-cron-job-1591543920-bdxbd   0/1     Completed   0          8m35s   minikube   <none>           <none>         
sample-cron-job-1591543920-f5qsk   0/1     Completed   0          8m27s   minikube   <none>           <none>         
sample-cron-job-1591543920-fcspj   0/1     Completed   0          11m   minikube   <none>           <none>         
sample-cron-job-1591543980-969sd   0/1     Completed   0          7m32s   minikube   <none>           <none>         
sample-cron-job-1591543980-chkxm   0/1     Completed   0          10m   minikube   <none>           <none>         
sample-cron-job-1591543980-f2lrx   0/1     Completed   0          7m19s   minikube   <none>           <none>         
sample-cron-job-1591543980-gqjh9   0/1     Completed   0          10m   minikube   <none>           <none>         
sample-cron-job-1591543980-rqx6r   0/1     Completed   0          4m21s   minikube   <none>           <none>         
sample-cron-job-1591544040-59rlh   0/1     Completed   0          9m44s   minikube   <none>           <none>         
sample-cron-job-1591544040-b445v   0/1     Completed   0          6m17s   minikube   <none>           <none>         
sample-cron-job-1591544040-p2485   1/1     Running     0          3m9s   minikube   <none>           <none>         
sample-cron-job-1591544040-wjh9w   0/1     Completed   0          6m6s   minikube   <none>           <none>         
sample-cron-job-1591544040-xwsr2   0/1     Completed   0          9m44s   minikube   <none>           <none>         
sample-cron-job-1591544100-6hwjn   0/1     Completed   0          5m25s   minikube   <none>           <none>         
sample-cron-job-1591544100-hpzzm   0/1     Completed   0          8m43s   minikube   <none>           <none>         
sample-cron-job-1591544100-lbrz4   0/1     Completed   0          8m43s   minikube   <none>           <none>         
sample-cron-job-1591544100-pln5k   1/1     Running     0          2m17s    minikube   <none>           <none>         
sample-cron-job-1591544100-plstw   0/1     Completed   0          5m31s    minikube   <none>           <none>         
sample-cron-job-1591544160-849hq   0/1     Completed   0          4m36s   minikube   <none>           <none>         
sample-cron-job-1591544160-fw5pf   0/1     Completed   0          4m28s   minikube   <none>           <none>         
sample-cron-job-1591544160-jrj2g   0/1     Completed   0          7m43s   minikube   <none>           <none>         
sample-cron-job-1591544160-nwpqc   1/1     Running     0          80s   minikube   <none>           <none>         
sample-cron-job-1591544160-p8sqm   0/1     Completed   0          7m43s   minikube   <none>           <none>         
sample-cron-job-1591544220-7h4zs   0/1     Completed   0          3m33s   minikube   <none>           <none>         
sample-cron-job-1591544220-gpnpx   0/1     Completed   0          6m43s   minikube   <none>           <none>         
sample-cron-job-1591544220-m9cxn   0/1     Completed   0          3m26s   minikube   <none>           <none>         
sample-cron-job-1591544220-rv8dz   0/1     Completed   0          6m43s   minikube   <none>           <none>         
sample-cron-job-1591544220-xvrjr   1/1     Running     0          18s   minikube   <none>           <none>         
sample-cron-job-1591544280-9jgxm   1/1     Running     0          2m27s   minikube   <none>           <none>         
sample-cron-job-1591544280-cdvhh   0/1     Completed   0          5m43s   minikube   <none>           <none>         
sample-cron-job-1591544280-kpv7r   0/1     Completed   0          5m43s   minikube   <none>           <none>         
sample-cron-job-1591544280-r46sd   1/1     Running     0          2m35s   minikube   <none>           <none>         
sample-cron-job-1591544340-27v4m   1/1     Running     0          87s   minikube   <none>           <none>         
sample-cron-job-1591544340-4qvfs   1/1     Running     0          94s   minikube   <none>           <none>         
sample-cron-job-1591544340-6k99d   0/1     Completed   0          4m43s   minikube   <none>           <none>         
sample-cron-job-1591544340-mk2lg   0/1     Completed   0          4m43s   minikube   <none>           <none>         
sample-cron-job-1591544400-4j8jh   0/1     Completed   0          3m43s   minikube   <none>           <none>         
sample-cron-job-1591544400-9mls2   1/1     Running     0          25s   minikube   <none>           <none>         
sample-cron-job-1591544400-bk8pm   0/1     Completed   0          3m43s   minikube   <none>           <none>         
sample-cron-job-1591544400-q4w9x   1/1     Running     0          32s   minikube   <none>           <none>         
sample-cron-job-1591544460-9kvlr   1/1     Running     0          2m42s   minikube   <none>           <none>         
sample-cron-job-1591544460-c7v8n   1/1     Running     0          2m42s   minikube   <none>           <none>



Labels (2)
0 Kudos
0 Replies
Join the discussion
You must log in to join this conversation.