Search code examples
kuberneteskubernetes-pod

Kubernetes pod went down


I am pretty new to Kubernetes so I don't have much idea. Last day a pod went down and I was thinking if I would be able to recover the tmp folder.

So basically I want to know that when a pod in Kubernetes goes down, does it lose access to the "/tmp" folder ?


Solution

  • Unless you configure otherwise, this folder will be considered storage within the container, and the contents will be lost when the container terminates.

    Similarly to how you can run a container in docker, write something to the filesystem within the container, then stop and remove the container, start a new one, and find the file you wrote within the container is no longer there.

    If you want to keep the /tmp folder contents between restarts, you'll need to attach a persistent volume to it and mount it as /tmp within the container, but with the caveat that if you do that, you cannot use that same volume with other replicas in a deployment unless you use a read-write-many capable filesystem underneath, like NFS.