<p>Consider there is one <code>rollout</code> in K8s setting and it creates 2 <code>replicaSet</code>s, each replicaSet has a single <code>pod</code>. Each pod include the same application that has a <code>volume</code> to directory with same value (i.e. /dir/logs/)</p>
<pre><code>Rollout
  |_____ReplicaSet1
            |_______Pod1
                |________Volume (/logs/ mount to /dir/logs/)
  |_____ReplicaSet2
            |_______Pod2
                |________Volume (/logs/ mount to /dir/logs/)
</code></pre>
<p>If application in <code>Pod1</code> will output log to file</p>
<pre><code> /logs/application.log
</code></pre>
<p>And application in <code>Pod2</code> has the same definition</p>
<pre><code> /logs/application.log
</code></pre>
<p>is it going to be an <code>locking</code> issue, so that application in <code>pod1</code> can write data in /logs/application.log that application in <code>pod2</code> can't access the file because it is being written by <code>pod1</code>? How to configure <code>K8s</code> so that multiple pods won't facing such issue?</p>

Dreamer
<p>Include the pod name as an environment variable and then use this as part of your log path:</p>
<pre><code>...
          env:
            - name: PODNAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          command:
            - sh
            - -c
            - |
              exec myapplication --logfile /logs/$PODNAME.log
...
</code></pre>
