kube/cronjobs
This commit is contained in:
parent
ad670c36ff
commit
9872f2d6ff
1 changed files with 61 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
**********
|
||||
Kubernetes
|
||||
kubernetes
|
||||
**********
|
||||
|
||||
* Deployment → ReplicaSet → Pods → Containers
|
||||
|
@ -279,3 +279,63 @@ Write
|
|||
delete job my-job \
|
||||
cascade=false \
|
||||
-n my-namespace
|
||||
|
||||
CronJobs
|
||||
========
|
||||
|
||||
Read
|
||||
----
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
get cronjobs \
|
||||
-n my-namespace
|
||||
|
||||
Write
|
||||
-----
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
create cronjob my-cronjob \
|
||||
--image my-image \
|
||||
--schedule '*/4 * * * *' \
|
||||
-n my-namespace
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: my-cronjob
|
||||
spec:
|
||||
schedule: '*/4 * * * *'
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: my-container
|
||||
image: my-image
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /usr/bin/bash
|
||||
- -c
|
||||
- command
|
||||
failedHistoryLimit: 2
|
||||
successfulJobsHistoryLimit: 1
|
||||
restartPolicy: OnFailure
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
patch cronjob my-cronjob \
|
||||
-p '{"spec":{"schedule": "*/4 * * * *"}}' \
|
||||
-n my-namespace
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
delete cronjob my-cronjob \
|
||||
-n my-namespace
|
||||
|
|
Loading…
Reference in a new issue