no such file or directory error while executing yaml file as a cron job

0 votes

I was trying to execute a yaml file as cron job and got the following error:

container_linux.go:247: starting container process caused "exec: \"/home/ubuntu/\": stat /home/ubuntu/ no such file or directory"

This is my yaml file:

job2.yaml file 
apiVersion: batch/v1beta1
 kind: CronJob metadata:
   name: ghost
    role: blog
 spec:   schedule: "*/1 * * * *"   jobTemplate:
          - name: ghost
            image: ghost:0.11-alpine
            command: ["/home/ubuntu/"]
          restartPolicy: OnFailure
Sep 18, 2018 in Kubernetes by lina
• 8,220 points

1 answer to this question.

0 votes

When you get errors like these, you first check if the job was executed a cron job, if the file exists and is executable

you can run it from kubectl run command:

kubectl run ghost --schedule="*/1 * * * *" --restart=OnFailure --image=ghost:0.11-alpine -- /bin/sh -c "your check script content" 
answered Sep 18, 2018 by Kalgi
• 52,370 points

Related Questions In Kubernetes

0 votes
3 answers

Using multiple commands in a kubernetes yaml file

Try something like this: containers: - name: ...READ MORE

answered Apr 23, 2019 in Kubernetes by lyza
0 votes
1 answer

How to fail a (cron) job after a certain number of retries?

You're trying to set 3 asbackoffLimit of your Job. ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 52,370 points
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,370 points

reshown Apr 12, 2019 by Kalgi 3,547 views
+1 vote
4 answers

Execute shell script file using kubernetes as a cron job

use /bin/sh instead of /bin/bash This solved it ...READ MORE

answered May 7, 2019 in Kubernetes by Sid
0 votes
1 answer