Kubernetes Persistent Storage Objects you must know About

Kubernetes Persistent Storage Objects you must know About

In Kubernetes, persistent storage refers to data that is stored outside of a container's filesystem and is not deleted when the container is removed. Persistent storage is useful for a variety of purposes, such as storing databases, file shares, and backups. In this blog post, we will discuss some of the most important persistent storage objects that you should be familiar with when working with Kubernetes.

Persistent Volumes (PVs)

A Persistent Volume (PV) represents a piece of storage in the cluster that has been provisioned by an administrator. PVs can be provisioned in a variety of ways, such as using a storage class or manually creating a PV using a yaml file. PVs can be used by one or more pods at a time, and are not tied to any specific pod or node.

Persistent Volume Claims (PVCs)

A Persistent Volume Claim (PVC) is a request for a specific amount of storage from a PV. When a pod needs storage, it creates a PVC, which is then matched with an available PV. Once the PV is allocated to the PVC, the pod can access the storage.

Storage Classes

A Storage Class is a way to dynamically provision PVs based on the storage needs of a cluster. When a PVC is created, it can specify a storage class, which is then used to dynamically provision a PV that matches the storage requirements of the PVC.

Provisioners

In addition to defining the Storage Class, you also need to have a provisioner which will actually monitor to the PVC requested, and create the volumes based on the Storage Class selected. A provisioner can be internal, which would mean Kubernetes already knows how to talk to the storage system (e.g. EBS volumes or Azure Disks) inherently. In case not internal, a provisioner has to be deployed in the form of a pod within the kubernetes environment, which would then listen to PVCs and take action based on it (e.g. NFS provisioner).

No alt text provided for this image
Kubernetes Storage Concepts by School of Devops


StatefulSets

A StatefulSet is a Kubernetes resource that manages the deployment and scaling of stateful applications. One of the main benefits of StatefulSets is that they provide stable, unique network identities for each pod and maintain persistent storage across pod restarts. StatefulSets also ensure that each pod has a exclusive persistent volume of its own.

Deployments

Deployment is a Kubernetes resource that describes how many replicas of a pod should be running at any given time and how they should be updated. While Deployment alone does not provide persistent storage, it can be combined with StatefulSets or PVCs to provide a way to manage the scaling and updates of stateful applications. Within the deployment's pod spec (template.spec) you would find volumes and volumeMount configurations.

These are just a few of the persistent storage objects that you should be familiar with when working with Kubernetes. Understanding how these objects work together can help you to effectively manage the storage needs of your cluster and ensure that your stateful applications are running smoothly.

Mourad NAKIB

Solutions Architect

2 年

A great overview! As usual ????

回复

要查看或添加评论,请登录

Gourav Shah的更多文章

社区洞察

其他会员也浏览了