tezvyn:

Sharing ephemeral cache between containers in a Pod

Source: interviewintermediate

WHAT IT TESTS: Choosing the right ephemeral volume. OUTLINE: Use an emptyDir volume defined in the Pod spec and mounted into each container at the cache path; it is created with the Pod and deleted when the Pod is removed.

WHAT IT TESTS: Whether you match volume lifecycle to data lifecycle. ANSWER OUTLINE: Use an emptyDir volume. Declare it once under the Pod's volumes, then add a volumeMount referencing it in each container at the desired path. emptyDir is created empty when the Pod is assigned to a node and is deleted permanently when the Pod is removed, so it perfectly fits shared, throwaway cache. You can set medium: Memory to back it with tmpfs. RED FLAG: Proposing a PersistentVolume or hostPath, which outlive the Pod or tie data to a node.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Sharing ephemeral cache between containers in a Pod · Tezvyn