<p>Below is deployment yaml,  after deployment, I could access the pod
and I can see the mountPath "/usr/share/nginx/html", but I could not find
"/work-dir" which should be created by initContainer.
Could someone explain me the reason?
Thanks and Rgds</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
 name: init-demo
spec:
 containers:
 - name: nginx
   image: nginx
   ports:
   - containerPort: 80
   volumeMounts:
   - name: workdir
     mountPath: /usr/share/nginx/html
 # These containers are run during pod initialization
 initContainers:
 - name: install
   image: busybox
   command:
   - wget
   - "-O"
   - "/work-dir/index.html"
   - http://kubernetes.io
   volumeMounts:
   - name: workdir
     mountPath: "/work-dir"
 dnsPolicy: Default
 volumes:
 - name: workdir
   emptyDir: {}
</code></pre>

stewchicken
<p>The volume at "/work-dir" is mounted by the init container and the "/work-dir" location only exists in the init container. When the init container completes, its file system is gone so the "/work-dir" directory in that init container is "gone". The application (nginx) container mounts the same <em>volume</em>, too, (albeit at a different location) providing mechanism for the two containers to share its content. </p>

<p>Per the <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#using-init-containers" rel="nofollow noreferrer">docs</a>:</p>

<blockquote>
  <p>Init containers can run with a different view of the filesystem than
  app containers in the same Pod.</p>
</blockquote>
