An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
Hi @37821879,
to create cronjob to restart nginx deployment every day at midnight (00:00) using the schedule field. you can deploy this YAML
If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.
Thank you for helping to improve Microsoft Q&A!
apiVersion: batch/v1
kind: CronJob
metadata:
name: restart-deployment
namespace: nginx-basic
spec:
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 2
concurrencyPolicy: Forbid
schedule: "0 0 * * *"
jobTemplate:
spec:
backoffLimit: 2
activeDeadlineSeconds: 600
template:
spec:
restartPolicy: Never
containers:
- name: kubectl
image: kubectl
command:
- 'kubectl'
- 'rollout'
- 'restart'
- 'deployment/nginx'