Welcome to the Linux Foundation Forum!

Volume Spec - emptyDir in container or pod?

The lfs258 documentation about emptyDir says 'The kubelet will create the directory in the container'.
https://kubernetes.io/docs/concepts/storage/volumes/ says 'An emptyDir volume is first created when a Pod is assigned to a node'

Now I get confused: When is the pod created? At the moment the first container is created? Or is first the pod created, then the emptyDir and then the containers. To my feeling lfs258 and kubernetes.io/docs contradict. But I can be very wrong.

Comments

  • chrispokorni
    chrispokorni Posts: 2,349
    edited February 2021

    Hi @RonaldHeirbaut,

    The kube-scheduler is the control plane agent responsible for the Pod-to-Node assignment. The kube-apiserver hands over the Pod configuration to the Node's kubelet, the node-agent responsible to resolve Pod dependencies prior to the Pod being actually deployed. At this point, the Pod is scheduled, but not yet deployed. Volumes (emptyDir, hostPath, cephfs, etc.), ConfigMaps, Secrets, are examples of such dependencies, which need to be resolved by kubelet, in other words to ensure these resources are available and ready prior to the Pod being deployed. Once the dependencies are cleared, the Containers of the Pod are run by the Container Runtime at the request of the kubelet node-agent, ensuring these dependent resources are mounted or attached to the Container's environment.

    Regards,
    -Chris

  • That cleared it for me. Thanks!

Categories

Upcoming Training