'Provide files for kubernetes job

I am trying to create a Kubernetes job, that would run from some machine. I would like that job could somehow copy files from this machine into container running within job itself and do something with them. First of all, is it a good approach? Secondly, how could I do that? My k8s job is supposed to run some pre-built image from registry. I know I could build such image by myself and include desired files into that however I wonder if I can skip that step? I've read also about configMaps, however they are flat and my templates folder can also have folder inside.

Let's have an example: Machine X has directory /templates. I run kubectl apply -f my-job.yaml and I would like that this container inside of this job would have the same files as these located in /templates.

Would be grateful for any tips how to achieve that.



Solution 1:[1]

you can create a configmap ,then mount it on pod

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 focus zheng