Sharing volumes between containers in the same Pod
In this section, we’ll learn what volumes are from a Kubernetes point of view and how to use them. Docker also has volumes, but they differ from Kubernetes volumes: they answer the same need but they are not the same.
We will discover what Kubernetes volumes are, why they are useful, and how they can help us when it comes to Kubernetes volumes.
What are Kubernetes volumes?
We are going to answer a simple problem. Our multi-container Pods are currently made up of two containers: an NGINX one and a Debian one. We are going to try sharing the log directory in the NGINX container with the Debian container by mounting the log directory of NGINX in the directory of the Debian container. This way, we will create a relationship between the two containers to have them share a directory.
Kubernetes has two kinds of volumes:
- Volumes, which we will discuss here.
PersistentVolume
, which is a more advanced...