<p>What is the best way to inject a file into a Pod?
I did it using a configMap but now I have an xml file that is bigger than 1MB so need to find some other way. The file is available in the git repository.</p>

AdamU
<p>As @Arghya Sadhu mentioned </p>

<blockquote>
  <p>You can store it in a <a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="nofollow noreferrer">volume</a> and <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/" rel="nofollow noreferrer">mount</a> that volume into the pod.</p>
</blockquote>

<hr>

<p>There was storage called <a href="https://kubernetes.io/docs/concepts/storage/volumes/#gitrepo" rel="nofollow noreferrer">gitRepo</a> which might be the best solution for you, but as now it's deprecated.</p>

<blockquote>
  <p>Warning: The gitRepo volume type is deprecated. To provision a container with a git repo, mount an <a href="https://kubernetes.io/docs/concepts/storage/volumes/#emptydir" rel="nofollow noreferrer">EmptyDir</a> into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod’s container.</p>
</blockquote>

<h2>emptyDir</h2>

<blockquote>
  <p>An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. As the name says, it is initially empty. Containers in the Pod can all read and write the same files in the emptyDir volume, though that volume can be mounted at the same or different paths in each Container. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever.</p>
  
  <p>Note: A Container crashing does NOT remove a Pod from a node, so the data in an emptyDir volume is safe across Container crashes.</p>
</blockquote>

<p>Some uses for an emptyDir are:</p>

<blockquote>
  <ul>
  <li>scratch space, such as for a disk-based merge sort</li>
  <li>checkpointing a long computation for recovery from crashes</li>
  <li>holding files that a content-manager Container fetches while a
  webserver Container serves the data</li>
  </ul>
  
  <p>By default, emptyDir volumes are stored on whatever medium is backing the node - that might be disk or SSD or network storage, depending on your environment. However, you can set the emptyDir.medium field to "Memory" to tell Kubernetes to mount a tmpfs (RAM-backed filesystem) for you instead. While tmpfs is very fast, be aware that unlike disks, tmpfs is cleared on node reboot and any files you write will count against your Container’s memory limit.</p>
</blockquote>

<h2>Example Pod</h2>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-pd
spec:
  containers:
  - image: k8s.gcr.io/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /cache
      name: cache-volume
  volumes:
  - name: cache-volume
    emptyDir: {}
</code></pre>

<hr>

<p>Check this stackoverflow <a href="https://stackoverflow.com/a/44149704/11977760">answer</a>, as it might be the solution you're looking for.</p>

<hr>

<p>If you want to read more about storage in kubernetes take a look here:</p>

<ul>
<li><a href="https://www.magalix.com/blog/kubernetes-storage-101" rel="nofollow noreferrer">https://www.magalix.com/blog/kubernetes-storage-101</a></li>
<li><a href="https://kubernetes.io/docs/concepts/storage/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/</a></li>
</ul>
