Mount volumes on ephemeral containers created at runtime

Cluster information:

Kubernetes version: v1.27.4
Cloud being used: DigitalOcean

Problem

Goodmorning everyone,
I have a deployment in kubernetes that has a special use case. It needs to create containers that mount a volume and perform some operations on the mounted files.
I tried creating a new pod/job for each request(1 pod contains only 1 container, to satisfy that request) but it is extremely inefficient (a pod needs 10-15s to startup and requires a lot of resources).
Then I looked around and I have found ephemeral containers that seem to suit perfectly my use case, the only problem is that there is little documentation on them.

I have the following questions:

  • What is in your opinion the best approach to quickly spawn a series of on-off tasks that support the “kubectl exec” command to allow remote access?
  • Is there a way to spawn containers on an already running pod?
  • How do I work with ephemeral containers? How do I attach a volume on them?

To be more clear, I am currently spawning and handling these pod from a nodejs program (located in a kubernetes deployment) using the kubernetes client node npm package.

Thank you for your help,
Nicola