Add ScheduledJobs to menu and remove future work section from jobs
This commit is contained in:
+4
-2
@@ -70,7 +70,7 @@ toc:
|
|||||||
section:
|
section:
|
||||||
- title: Example Walkthrough
|
- title: Example Walkthrough
|
||||||
path: /docs/getting-started-guides/network-policy/walkthrough/
|
path: /docs/getting-started-guides/network-policy/walkthrough/
|
||||||
- title: Using Calico for NetworkPolicy
|
- title: Using Calico for NetworkPolicy
|
||||||
path: /docs/getting-started-guides/network-policy/calico/
|
path: /docs/getting-started-guides/network-policy/calico/
|
||||||
- title: Using Romana for NetworkPolicy
|
- title: Using Romana for NetworkPolicy
|
||||||
path: /docs/getting-started-guides/network-policy/romana/
|
path: /docs/getting-started-guides/network-policy/romana/
|
||||||
@@ -85,6 +85,8 @@ toc:
|
|||||||
path: /docs/user-guide/jobs/work-queue-1/
|
path: /docs/user-guide/jobs/work-queue-1/
|
||||||
- title: Fine Parallel Processing using a Work Queue
|
- title: Fine Parallel Processing using a Work Queue
|
||||||
path: /docs/user-guide/jobs/work-queue-2/
|
path: /docs/user-guide/jobs/work-queue-2/
|
||||||
|
- title: Scheduled Jobs
|
||||||
|
path: /docs/user-guide/scheduled-jobs/
|
||||||
|
|
||||||
- title: Service Discovery and Load Balancing
|
- title: Service Discovery and Load Balancing
|
||||||
section:
|
section:
|
||||||
@@ -293,7 +295,7 @@ toc:
|
|||||||
- title: Configuring kubelet Garbage Collection
|
- title: Configuring kubelet Garbage Collection
|
||||||
path: /docs/admin/garbage-collection/
|
path: /docs/admin/garbage-collection/
|
||||||
- title: Configuring Out Of Resource Handling
|
- title: Configuring Out Of Resource Handling
|
||||||
path: /docs/admin/out-of-resource/
|
path: /docs/admin/out-of-resource/
|
||||||
- title: Configuring Kubernetes with Salt
|
- title: Configuring Kubernetes with Salt
|
||||||
path: /docs/admin/salt/
|
path: /docs/admin/salt/
|
||||||
- title: Monitoring Node Health
|
- title: Monitoring Node Health
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ A _Scheduled Job_ manages time based [Jobs](/docs/user-guide/jobs/), namely:
|
|||||||
One ScheduledJob object is like one line of a _crontab_ (cron table) file. It runs a job periodically
|
One ScheduledJob object is like one line of a _crontab_ (cron table) file. It runs a job periodically
|
||||||
on a given schedule, written in [Cron](https://en.wikipedia.org/wiki/Cron) format.
|
on a given schedule, written in [Cron](https://en.wikipedia.org/wiki/Cron) format.
|
||||||
|
|
||||||
|
NOTE: The question mark (`?`) in the schedule has the same meaning as an asterisk `*`,
|
||||||
|
that is, it stands for any of available value for a given field.
|
||||||
|
|
||||||
A typical use case is:
|
A typical use case is:
|
||||||
|
|
||||||
* Schedule a job execution at a given point in time.
|
* Schedule a job execution at a given point in time.
|
||||||
@@ -48,7 +51,7 @@ scheduledjob "hello" created
|
|||||||
Alternatively, use `kubectl run` to create a scheduled job without writing full config:
|
Alternatively, use `kubectl run` to create a scheduled job without writing full config:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ kubectl run hello --schedule="0/1 * * * ?" --restart=OnFailure --image=busybox -- /bin/sh -c "date; echo Hello from the Kubernetes cluster"
|
$ kubectl run hello --schedule="*/1 * * * *" --restart=OnFailure --image=busybox -- /bin/sh -c "date; echo Hello from the Kubernetes cluster"
|
||||||
scheduledjob "hello" created
|
scheduledjob "hello" created
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -57,10 +60,10 @@ After creating the scheduled job, get its status using this command:
|
|||||||
```shell
|
```shell
|
||||||
$ kubectl get scheduledjob hello
|
$ kubectl get scheduledjob hello
|
||||||
NAME SCHEDULE SUSPEND ACTIVE LAST-SCHEDULE
|
NAME SCHEDULE SUSPEND ACTIVE LAST-SCHEDULE
|
||||||
hello 0/1 * * * ? False 0 <none>
|
hello */1 * * * * False 0 <none>
|
||||||
```
|
```
|
||||||
|
|
||||||
As you can see above, there's no active job yet, and no job has been scheduled, either.
|
As you can see above, there's no active job yet, and no job has been scheduled, either.
|
||||||
|
|
||||||
Watch for the job to be created in around one minute:
|
Watch for the job to be created in around one minute:
|
||||||
|
|
||||||
@@ -75,11 +78,11 @@ Now you've seen one running job scheduled by "hello". We can stop watching it an
|
|||||||
```shell
|
```shell
|
||||||
$ kubectl get scheduledjob hello
|
$ kubectl get scheduledjob hello
|
||||||
NAME SCHEDULE SUSPEND ACTIVE LAST-SCHEDULE
|
NAME SCHEDULE SUSPEND ACTIVE LAST-SCHEDULE
|
||||||
hello 0/1 * * * ? False 0 Mon, 29 Aug 2016 14:34:00 -0700
|
hello */1 * * * * False 0 Mon, 29 Aug 2016 14:34:00 -0700
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see that "hello" successfully scheduled a job at the time specified in `LAST-SCHEDULE`. There are
|
You should see that "hello" successfully scheduled a job at the time specified in `LAST-SCHEDULE`. There are
|
||||||
currently 0 active jobs, meaning that the job that's scheduled is completed or failed.
|
currently 0 active jobs, meaning that the job that's scheduled is completed or failed.
|
||||||
|
|
||||||
Now, find the pods created by the job last scheduled and view the standard output of one of the pods. Note that
|
Now, find the pods created by the job last scheduled and view the standard output of one of the pods. Note that
|
||||||
your job name and pod name would be different.
|
your job name and pod name would be different.
|
||||||
@@ -96,7 +99,7 @@ Mon Aug 29 21:34:09 UTC 2016
|
|||||||
Hello from the Kubernetes cluster
|
Hello from the Kubernetes cluster
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deleting a Scheduled Job
|
## Deleting a Scheduled Job
|
||||||
|
|
||||||
Once you don't need a scheduled job anymore, simply delete it with `kubectl`:
|
Once you don't need a scheduled job anymore, simply delete it with `kubectl`:
|
||||||
|
|
||||||
@@ -122,7 +125,7 @@ job "hello-1202039034" deleted
|
|||||||
```
|
```
|
||||||
|
|
||||||
Once the jobs are deleted, the pods created by them are deleted as well. Note that all jobs created by scheduled
|
Once the jobs are deleted, the pods created by them are deleted as well. Note that all jobs created by scheduled
|
||||||
job "hello" will be prefixed "hello-". You can delete them at once with `kubectl delete jobs --all`, if you want to
|
job "hello" will be prefixed "hello-". You can delete them at once with `kubectl delete jobs --all`, if you want to
|
||||||
delete all jobs in the current namespace (not just the ones created by "hello".)
|
delete all jobs in the current namespace (not just the ones created by "hello".)
|
||||||
|
|
||||||
## Scheduled Job Limitations
|
## Scheduled Job Limitations
|
||||||
@@ -137,7 +140,7 @@ of the set of pods. A scheduled job does not examine pods at all.
|
|||||||
## Writing a Scheduled Job Spec
|
## Writing a Scheduled Job Spec
|
||||||
|
|
||||||
As with all other Kubernetes configs, a scheduled job needs `apiVersion`, `kind`, and `metadata` fields. For general
|
As with all other Kubernetes configs, a scheduled job needs `apiVersion`, `kind`, and `metadata` fields. For general
|
||||||
information about working with config files, see [deploying applications](/docs/user-guide/deploying-applications),
|
information about working with config files, see [deploying applications](/docs/user-guide/deploying-applications),
|
||||||
[configuring containers](/docs/user-guide/configuring-containers), and
|
[configuring containers](/docs/user-guide/configuring-containers), and
|
||||||
[using kubectl to manage resources](/docs/user-guide/working-with-resources) documents.
|
[using kubectl to manage resources](/docs/user-guide/working-with-resources) documents.
|
||||||
|
|
||||||
@@ -145,10 +148,10 @@ A scheduled job also needs a [`.spec` section](https://github.com/kubernetes/kub
|
|||||||
|
|
||||||
**Note:** All modifications to a scheduled job, especially its `.spec`, will be applied only to the next run.
|
**Note:** All modifications to a scheduled job, especially its `.spec`, will be applied only to the next run.
|
||||||
|
|
||||||
### Schedule
|
### Schedule
|
||||||
|
|
||||||
The `.spec.schedule` is a required field of the `.spec`. It takes a [Cron](https://en.wikipedia.org/wiki/Cron) format
|
The `.spec.schedule` is a required field of the `.spec`. It takes a [Cron](https://en.wikipedia.org/wiki/Cron) format
|
||||||
string, e.g. `0 * * * *` or `@hourly`, as schedule time of its jobs to be created and executed.
|
string, e.g. `0 * * * *` or `@hourly`, as schedule time of its jobs to be created and executed.
|
||||||
|
|
||||||
### Job Template
|
### Job Template
|
||||||
|
|
||||||
@@ -159,8 +162,8 @@ as a [Job](/docs/user-guide/jobs), except it is nested and does not have an `api
|
|||||||
### Starting Deadline Seconds
|
### Starting Deadline Seconds
|
||||||
|
|
||||||
The `.spec.startingDeadlineSeconds` field is optional. It stands for the deadline (in seconds) for starting the job
|
The `.spec.startingDeadlineSeconds` field is optional. It stands for the deadline (in seconds) for starting the job
|
||||||
if it misses its scheduled time for any reason. Missed jobs executions will be counted as failed ones. If not specified,
|
if it misses its scheduled time for any reason. Missed jobs executions will be counted as failed ones. If not specified,
|
||||||
there's no deadline.
|
there's no deadline.
|
||||||
|
|
||||||
### Concurrency Policy
|
### Concurrency Policy
|
||||||
|
|
||||||
@@ -176,5 +179,5 @@ scheduled jobs, their respective jobs are always allowed to run concurrently.
|
|||||||
|
|
||||||
### Suspend
|
### Suspend
|
||||||
|
|
||||||
The `.spec.suspend` field is also optional. If set to `true`, all subsequent executions will be suspended. It does not
|
The `.spec.suspend` field is also optional. If set to `true`, all subsequent executions will be suspended. It does not
|
||||||
apply to already started executions. Defaults to false.
|
apply to already started executions. Defaults to false.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ kind: ScheduledJob
|
|||||||
metadata:
|
metadata:
|
||||||
name: hello
|
name: hello
|
||||||
spec:
|
spec:
|
||||||
schedule: 0/1 * * * ?
|
schedule: "*/1 * * * *"
|
||||||
jobTemplate:
|
jobTemplate:
|
||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
|
|||||||
Reference in New Issue
Block a user