We're using Openshift (a managed version of Kubernetes) and I'm struggling to set the pod restart policy from 'Always' to 'Never' for all pods created by our deployment config, but I'm not sure where in the yaml to make this change.
Our deployment config looks something like:
kind: DeploymentConfig
metadata:
generation: 19
name: my-deployment-config
namespace: my-deployment-config-namespace
selfLink: >-
...
uid: af918183-c780-11ea-8945-525400d3e4d9
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
name: my-selector
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
...
spec:
containers:
- image: >-
(image source)
imagePullPolicy: Always
name: my-container
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
When I try to change restartPolicy there from 'Always' to 'Never', I'm met with
Failed to process the resource. Reason: DeploymentConfig.apps.openshift.io "my-deployment-config" is invalid: spec.template.spec.restartPolicy: Unsupported value: "Never": supported values: "Always"
The Kubernetes documentation as well as the Openshift documentation on restart policy shows that pods can be configured with Always, Never, or OnFailure.
So how do I do that from a deployment config?
Deployment
child(ren) pod(s) to not restart on completion / failure. – Calondra