How to mimic Docker ability to pre-populate a volume from a container directory with Kubernetes How to mimic Docker ability to pre-populate a volume from a container directory with Kubernetes kubernetes kubernetes

How to mimic Docker ability to pre-populate a volume from a container directory with Kubernetes


I think your options are

  • ConfigMap (are "some data" configuration files?)
  • Init containers (as mentioned)
  • CSI Volume Cloning (clone combining an init or your first app container)
  • there used to be a gitRepo; deprecated in favour of init containers where you can clone your config and data from
  • HostPath volume mount is an option too
  • An NFS volume is probably a very reasonable option and similar from an approach point of view to your Docker Volumes
    • Storage type: NFS, iscsi, awsElasticBlockStore, gcePersistentDisk and others can be pre-populated. There are constraints. NFS probably the most flexible for sharing bits & bytes.

FYI The subPath might be of interest too depending on your use case andPodPreset might help in streamlining the op across the fleet of your pods

HTH