Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rhemz/5b3161851b0f86dd1022af3ceafe2f23 to your computer and use it in GitHub Desktop.
Save rhemz/5b3161851b0f86dd1022af3ceafe2f23 to your computer and use it in GitHub Desktop.
k8s doctl cronjob
apiVersion: batch/v1
kind: CronJob
metadata:
name: loadbalancer-add-port-forward
spec:
schedule: "*/10 * * * *"
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
jobTemplate:
spec:
backoffLimit: 1
template:
spec:
containers:
- name: loadbalancer-add-port-forward
image: digitalocean/doctl:1.67.0
env:
- name: DIGITALOCEAN_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: do-api-token
key: token
args:
- compute
- load-balancer
- add-forwarding-rules
- <the loadbalancer id>
- --forwarding-rules=entry_protocol:tcp,entry_port:1337,target_protocol:tcp,target_port:31304
restartPolicy: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment