AWS and kubernetes volumes - how to share configuration across multiple Pods?

10/29/2018

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

  1. Mount an NFS drive
  2. Add the configuration file to all of the nodes

If I provision multiple nodes then I have to mount the drive on all nodes.

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

-- sharman
amazon-s3
amazon-web-services
deployment
kubernetes

2 Answers

10/29/2018

If this is a relatively small file you can mount a ConfigMap value, see here:

https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#add-configmap-data-to-a-volume

-- Lev Kuznetsov
Source: StackOverflow

10/29/2018

The standard way to share configuration files is using a ConfigMap. 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.

There are multiple ways of using ConfigMaps described here.

Note, that there's a 1mb limit on a ConfigMap size. This is an etcd limitation.

If you are looking at storing larger files an NFS Volume would be an option.

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.

-- Rico
Source: StackOverflow