title: Configure restart policy of pod from deployment config
body: <p>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.</p>
  <p>Our deployment config looks something like:</p>
  <pre><code>kind: DeploymentConfig
  metadata:
    generation: 19
    name: my-deployment-config
    namespace: my-deployment-config-namespace
    selfLink: &gt;-
      ...
    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: &gt;-
              (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
  </code></pre>
  <p>When I try to change restartPolicy there from 'Always' to 'Never', I'm met with</p>
  <blockquote>
  <p>Failed to process the resource. Reason:
  DeploymentConfig.apps.openshift.io
  &quot;my-deployment-config&quot; is invalid:
  spec.template.spec.restartPolicy: Unsupported value: &quot;Never&quot;:
  supported values: &quot;Always&quot;</p>
  </blockquote>
  <p><a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" rel="nofollow noreferrer">The Kubernetes documentation</a> as well as the <a href="https://docs.openshift.com/container-platform/3.11/architecture/core_concepts/pods_and_services.html#admin-manage-pod-restart" rel="nofollow noreferrer">Openshift documentation</a> on restart policy shows that pods can be configured with Always, Never, or OnFailure.</p>
  <p>So how do I do that from a deployment config?</p>