<p>Fairly new to K8s and I am trying to find a way by which I can share a configuration file across pods.  Using hostPath mean I have to </p>

<ol>
<li>Mount an NFS drive</li>
<li>Add the configuration file to all of the nodes</li>
</ol>

<p>If I provision multiple nodes then I have to mount the drive on all nodes.  </p>

<p>Is there a way (S3) by which I can share the configuration?  Or if NFS is the best way to tackle it.</p>

sharman
<p>The standard way to share configuration files is using a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferrer"><code>ConfigMap</code></a>. Essentially once you create one and assign it to a pod spec as a volume it will get injected in all the pods in all the nodes where your pod is running.</p>

<p>There are multiple ways of using ConfigMaps described <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-a-configmap" rel="nofollow noreferrer">here</a>.</p>

<p>Note, that there's a <a href="https://github.com/kubernetes/kubernetes/issues/19781" rel="nofollow noreferrer">1mb limit</a> on a ConfigMap size. This is an etcd limitation.</p>

<p>If you are looking at storing larger files an <a href="https://kubernetes.io/docs/concepts/storage/volumes/#nfs" rel="nofollow noreferrer">NFS Volume</a> would be an option.</p>

<p>IMO, S3 (or any public cloud object storage) doesn't make sense to store configs, since it doesn't have the best performance, meaning you have to go outside your cluster to fetch a file. Also, there's no direct support in Kubernetes for object storage configs. </p>
