Skip to content

Instantly share code, notes, and snippets.

@nithu0115
Last active October 23, 2019 17:47
Show Gist options
  • Save nithu0115/c548a9bd60d370cbf4e54236a4e1f68a to your computer and use it in GitHub Desktop.
Save nithu0115/c548a9bd60d370cbf4e54236a4e1f68a to your computer and use it in GitHub Desktop.
cronjob testing
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: mlsmaycon1
spec:
schedule: "* * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
metadata:
labels:
app: mlsmaycon
spec:
containers:
- name: mlsmaycon
image: mlsmaycon/nettools
imagePullPolicy: IfNotPresent
args:
- /bin/bash
- -c
- echo myPOD IP $MY_POD_IP;COUNT=0;date +"%Y-%m-%d %H:%M:%S,%3N";until timeout 0.1 curl -s 10.100.73.91:9376; do echo CURL Failed on $(date +"%Y-%m-%d %H:%M:%S,%3N");COUNT=$((COUNT + 1));done;echo CURL failed $COUNT times"
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: MY_HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
resources:
requests:
cpu: 100m
memory: 128Mi
restartPolicy: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment