How can i retrieve any directory/file from the completed pod of a particular job in kubernetes? I am trying to store the output file locally from the container.
Asked
Active
Viewed 1,408 times
1
-
may be try to use a volume with retain policy – P.... Jun 14 '21 at 16:21
-
1checkout this for some relevant reading https://github.com/kubernetes/kubectl/issues/454 – P.... Jun 14 '21 at 16:28
-
Can you tell us little bit more about your use case? – acid_fuji Jun 15 '21 at 07:55
2 Answers
0
Kubernetes pods don't maintain state by default. You will need to use persistent volumes for data persistence (PVC/PV).
In order to retrieve files/directories from a completed job, you will have to mount the same persistent volume to another pod after your job is completed in order to retrieve the "output file"

Rakesh Gupta
- 3,507
- 3
- 18
- 24
0
Thanks for the suggestion!! I finally manage to do it by using init-container along with main container... one to run the real functioning i want the job for and another one to let the container sleep and then mounted an empty directory (PVC too can be used ofcourse) and shared with both main container and init-container.

0001000
- 11
- 3