Skip to content

Instantly share code, notes, and snippets.

@knil-sama
Created August 4, 2019 10:27
Show Gist options
  • Save knil-sama/f2e5cc7d017f3bd87dc5c1e4e1068c4f to your computer and use it in GitHub Desktop.
Save knil-sama/f2e5cc7d017f3bd87dc5c1e4e1068c4f to your computer and use it in GitHub Desktop.
Example cronjoblogging starting and ending of job in kube
kind: CronJob
metadata:
name: example
spec:
schedule: "10 3,15,20 * * *"
concurrencyPolicy: "Forbid"
suspend: false
jobTemplate:
spec:
template:
metadata:
annotations:
log/format: json
spec:
containers:
- name: example
image: python
lifecycle:
  postStart:
  exec:
  command: ["/bin/sh", "-c", "echo Container for load pipeline started"]
  preStop:
  exec:
  command: ["/bin/sh","-c","echo Container for load pipeline stopping"]
imagePullPolicy: Always
command: ["script.py"]
args: ["--flag","value"]
env:
- name: NAME_OF_VARIABLE_IN_JOB
valueFrom:
configMapKeyRef:
name: configmap_name
key: key_in_configmap
resources:
requests:
memory: "4Gi"
cpu: "1"
limits:
memory: "8Gi"
cpu: "2"
restartPolicy: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment