<p>Basically, as i have learned (still learning) Kubernetes and people say by creating object type Pod, main container which has core application code, should come first in yaml file. I did not understand why?</p>

<p>PS: sure i read Pod Priority, but still it's not clear to me</p>

<p>It is up to you how to configure pods definition config file and which container is put first because it is not important which container you will define first on its execution order.</p>

<p>If you want to run on container before another simply use <strong>init containers</strong>.
A Pod can have multiple containers running apps within it, but it can also have one or more init containers, which are run before the app containers are started.
Init containers have separate images from app containers, they have some advantages for start-up related code.
Init containers are exactly like regular containers, except:</p>

<ul>
<li>init containers always run to completion</li>
<li>each init container must complete successfully before the next one
starts.</li>
</ul>

<p>You can define priority for your pods defining priority class but it is connected with pods scheduling time not execution.
In Kubernetes 1.9 and later, when Pod priority is enabled, scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the higher priority Pod may be scheduled sooner than Pods with lower priority if its scheduling requirements are met. If such Pod cannot be scheduled, scheduler will continue and tries to schedule other lower priority Pods.</p>

<p>Official documentations: <a href="https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/" rel="nofollow noreferrer">kubernetes-pods-priority</a>, <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">init-containers</a>.</p>
