<p>Does anyone know why <code>restartPolicy</code> field is defined on the Pod level instead of the container level?</p>
<p>It would seem that this setting is more closely related to the container, not the Pod.</p>
<p>Then how to controll restart policy of single container in multi-container Pod?</p>

<p>I think <strong>restart policy</strong> is part of the <strong>POD</strong> spec.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  containers:
  - name: 1st
    image: image-1
    command: [&quot;./bash&quot;, &quot;-test1&quot;]
  - name: 2nd
    image: image-2
    command: [&quot;./bash&quot;, &quot;-test2&quot;]
  restartPolicy: Never
</code></pre>
<p>Restart policy gets set the at <strong>POD spec</strong> level, and get applied to all the containers in <strong>POD</strong> even if <strong>init container</strong> is there.</p>
<p>If there are <strong>multi containers</strong> inside the <strong>POD</strong>, we have to consider those as <strong>tightly coupled</strong>.</p>
<p><strong>Official documents says something like this</strong> : <a href="https://kubernetes.io/docs/concepts/workloads/pods/#workload-resources-for-managing-pods" rel="nofollow noreferrer">link</a></p>
<blockquote>
<p>Pods that run multiple containers that need to work together. A Pod can encapsulate an application composed of multiple co-located
containers that are tightly coupled and need to share resources. These
co-located containers form a single cohesive unit of service—for
example, one container serving data stored in a shared volume to the
public, while a separate sidecar container refreshes or updates those
files. The Pod wraps these containers, storage resources, and an
ephemeral network identity together as a single unit.</p>
</blockquote>
<blockquote>
<p>Note: Grouping multiple co-located and co-managed containers in a
single Pod is a relatively advanced use case. You should use this
pattern only in specific instances in which your containers are
tightly coupled.</p>
</blockquote>
<p>If you want to restart the <strong>single container</strong> in <strong>POD</strong> you won't be able to do it, you have keep that container out of <strong>POD</strong> then by <strong>POD</strong> design.</p>
<p>Even if you will see the <a href="https://You%20can%27t%20restart%20single%20containers%20in%20a%20pod%20by%20design.%20Just%20move%20the%20container%20out%20into%20it%27s%20own%20pod" rel="nofollow noreferrer">container restart policy</a> it's talk about the : <strong>POD spec</strong> restart policy only.</p>
