Running a cronjob in kubernetes

0 votes
I am trying to schedule Jobs in Kubernetes. The job can be created using the below command.

$ kubectl create -f ./cronjob.yaml

cronjob "hello" created

Is there any REST API using which the Job can be created from a Java client?
Sep 6, 2018 in Kubernetes by lina
• 8,200 points

1 answer to this question.

0 votes

You will find the CronJobresource in the batch/v1beta1 API group. To create a new CronJob resource, you'll need a POST call to the /apis/batch/v1beta1/namespaces/{namespace}/cronjobs URL.

A respective HTTP request might look something like this:

POST /apis/batch/v1beta1/namespaces/default/cronjobs HTTP/1.1
Content-Type: application/json
Content-Length: ...
Authorization: ...
[other headers]
  "metadata": {
    "name": "some-cron"
  "spec": {
answered Sep 6, 2018 by Kalgi
• 51,890 points

Related Questions In Kubernetes

0 votes
1 answer

Environment Variables inside a Cronjob in Kubernetes

Ofcourse you can. Cron job specification is ...READ MORE

answered Sep 18, 2018 in Kubernetes by Kalgi
• 51,890 points
+1 vote
1 answer

How to use a Volume to communicate between two Containers running in the same Kubernetes-Pod?

Create a Pod that runs two Containers Create a ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 55,620 points
0 votes
2 answers
0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,280 points
0 votes
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 11, 2019 in Kubernetes by Kalgi
• 51,890 points

reshown Apr 12, 2019 by Kalgi 2,243 views
0 votes
1 answer

Running A cronjob in a pod in Kubernetes

Unfortunately, you cannot run the CronJob inside a container ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 51,890 points
0 votes
1 answer