<p>I get a question about sharing Volume by Containers in one pod.</p>

<p>Here is my yaml, pod-volume.yaml</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: volume-pod
spec:
  containers:
  - name: tomcat
    image: tomcat
    imagePullPolicy: Never
    ports:
    - containerPort: 8080
    volumeMounts:
    - name: app-logs
      mountPath: /usr/local/tomcat/logs
  - name: busybox
    image: busybox
    command: ["sh", "-c", "tail -f /logs/catalina.out*.log"]
    volumeMounts:
    - name: app-logs
      mountPath: /logs
  volumes:
  - name: app-logs
    emptyDir: {}
</code></pre>

<p>create pod:</p>

<pre><code>kubectl create -f pod-volume.yaml
</code></pre>

<p>wacth pod status:</p>

<pre><code>watch kubectl get pod -n default
</code></pre>

<p>finally,I got this:</p>

<pre><code>NAME         READY   STATUS             RESTARTS   AGE
redis-php    2/2     Running            0          15h
volume-pod   1/2     CrashLoopBackOff   5          6m49s
</code></pre>

<p>then,I check logs about busybox container:</p>

<pre><code>kubectl logs pod/volume-pod -c busybox

tail: can't open '/logs/catalina.out*.log': No such file or directory
tail: no files
</code></pre>

<p>I don't know where is went wrong.
Is this an order of container start in pod, please help me, thanks</p>

Daiql
<p>For this case: </p>

<p>Catalina logs file is : <code>catalina.$(date '+%Y-%m-%d').log</code></p>

<p>And in <code>shell script</code> you should not put <code>*</code> into. </p>

<p>So please try: </p>

<p><code>command: ["sh", "-c", "tail -f /logs/catalina.$(date '+%Y-%m-%d').log"]</code></p>
