The problem
Kubernetes doesn’t provide data persistence out of the box, which means when a pod is re-created, the data (of a database application for example) is lost. 🙉
So, you need to create and configure the actual physical storage and manage it by yourself.

How to do it

Once configured, you can use that physical storage using Kubernetes storage components.
In this video I show you 3 different Kubernetes volume components, that you need to use to connect the actual physical storage to your pod, so that the application inside the container can access it.

3 Volume Components

  • The 1st component “Persistent Volume” is a cluster resource, like CPU or RAM, which is created and provisioned by administrators.
  • The 2nd component “Persistent Volume Claim” on the other hand is a user’s or pod’s request for a persistent volume.
  • With the 3rd component “Storage Class” you can dynamically provision Persistent Volume component and so automate the storage provisioning process.

ConfigMap and Secret as Volume Types
ConfigMap and Secret components can be used to:

  • create individual key-value pairs, like db credentials or db url
  • but also create configuration files, that can be mounted into the pod as volumes

You can find the full video here:

#kubernetes #devops #devopstools #tutorial #docker

Data Persistence in Kubernetes | Kubernetes Volumes explained 💯
4.60 GEEK