2 min read
When defining objects that contain a pod template (such a Deployment or a Job) but also when defining a plain pod we can control under which circumstances a pod will be restarted
The container restart policy can be controlled using restartPolicy on the spec at the same level where we define the containers:
apiVersion: batch/v1
kind: Job
metadata:
name: demo-restartPolicy-job
spec:
backoffLimit: 2
template:
metadata:
name: demo-restartPolicy-pod
spec:
containers:
- name: demo
image: sonarsource/sonar-scanner-cli
restartPolicy: Never
01/06/2021
Read more...