diff --git a/rtfd/public/kubernetes/index.rst b/rtfd/public/kubernetes/index.rst index e0a5727..83f083d 100644 --- a/rtfd/public/kubernetes/index.rst +++ b/rtfd/public/kubernetes/index.rst @@ -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