Difference bw configmap and downwardapi

4/26/2019

I am new to kubernetes can somebody please explain why there are multiple volume types like

  • configMap
  • emptyDir
  • projected
  • secret
  • downwardAPI
  • persistentVolumeClaim

For few I am able to figure out, like why we need secret instead of configmap. For rest I am not able to understand the need for others.

-- prashant
google-kubernetes-engine
kubernetes

2 Answers

4/26/2019

Configmap is used to make the application specific configuration data available to container at run time.

DownwardAPI is used to make kubernetes metadata ( like pod namespace, pod name, pod ip, pod lebels etc ) available to container at run time

-- P Ekambaram
Source: StackOverflow

4/26/2019

Your question is too generic to answer, here are the few comments off the top of my head

If the deployed pod or containers wants to have configuration data then you need to use configMap resource, if there are secrets or passwords its obvious to use secret resource.

Now if the deployed pods wants to use POD_NAME which is generated during schedule or Run time, then it need to use DownwardAPI resources.

Emptydir share the lifecycle with the Deployed pod, If the pods dies then all of the data which are stored using emptydir resource will be gone, now If you want to persist the data then you need to use persistentVolume, persistentVolumeClaim and storageclass Resources.

for further information k8s volumes

-- Suresh Vishnoi
Source: StackOverflow