Let's Learn Kubernetes - Basics - 3
Tags: beginners, kubernetes, devops, go
Published: 2021-10-19 17:33:20

Kubernetes is a container management tool that automates the deployment, scaling, and operations of an application. 
In the previous blog of ['Let's learn Kubernetes'](https://dev.to/pghildiyal/let-s-learn-kubernetes-basics-2-2a9a) Series, we have seen some fundamental topics such as Services, Load Balancers, ClusterIP, Nodeport, Ingress, DNS among others.

{% link pghildiyal/let-s-learn-kubernetes-basics-2-2a9a %}

Continuing with the series, this blog is all about storage in Kubernetes. In this blog we'll give a short explanation of each concept and then post a link that explains the same in-depth. 

Before diving in, it would be great if you can check out, star our repo Devtron, An End-to-End Kubernetes Software Delivery Workflow, which makes the DevOps workflow flawless for Developers, DevOps Engineers.
{% github devtron-labs/devtron no-readme %}

## Storage in Kubernetes

With the rise of Kubernetes as a method for hosting microservice-based processes, data storage is always a concern. When managing containerized environments, Kubernetes storage is useful for storage administrators, because it allows them to maintain multiple forms of persistent and non-persistent data in a Kubernetes cluster.

![Kubernetes Storage Illustration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4avkzywxxiiljd1abdq.png)

At a high level kubernetes uses the following types of storages described below:

### Persistent Volume & Persistent Volume Claims

A PersistentVolume (PV) is a storage resource in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes.

Persistent volumes are independent of the lifecycle of the pod that uses it, meaning that even if the pod shuts down, the data in the volume is not erased.In order for a Pod to start using these volumes, it must request a volume by issuing a persistent volume claim (PVC). PVCs describe the storage capacity and characteristics a pod requires, and the cluster attempts to match the request and provision the desired persistent volume.
  
On the other hand, A PersistentVolumeClaim (PVC) is a request sent by a Kubernetes node for storage.The claim can include specific storage parameters required by the application—for example an amount of storage, or a specific type of access (read/write, read-only, etc.). 
Kubernetes looks for a PV that meets the criteria defined in the user’s PVC, and if there is one, it matches the claim to PV. This is called binding.

![Persistent Volume Illustration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orklpdk0fnl3sw99bckt.png)

To know more about them checkout these listed links:

* [Kubernetes – Persistent Volumes](https://theithollow.com/2019/03/04/kubernetes-persistent-volumes/)

* [Persistent Volumes (PV) & Persistent Volume Claim(PVC) - A Video](https://www.youtube.com/watch?v=x2sMWUkasoE)

### Storage Classes

Kubernetes Storage Class Objects are specified by name in Persistent Volume Claims to provision storage with a set of properties. The storage class itself identifies the provisioner that will be used and defines that set of properties in terms the provisioner understands.
Each Storage Class contains the fields provisioner, parameters, and reclaim policy, which is used when a Persistent Volume belonging to the class needs to be dynamically provisioned.

To get a detailed view regarding Storage Classes check out the listed links:

* [Storage Classes](https://cloud.ibm.com/docs/containers?topic=containers-kube_concepts#storageclasses)

* [What Is a Kubernetes Storage Class?](https://www.youtube.com/watch?v=RAXPUTSO9p0)

### Dynamic provisioning of Storage Classes:

Kubernetes supports dynamic volume configuration, allowing you to create storage volumes on demand. Therefore, administrators do not have to manually create new storage volumes and then create a Persistent Volume object for use in the cluster. 

When the user requests a specific type of storage, the entire process runs automatically. The cluster administrator defines storage class objects as needed. Each Storage Class refers to a volume plugin, also called a provisioner. 

To get a more detailed view about the topic refer to the following video:

* [Dynamic Volume Provisioning in Kubernetes](https://www.youtube.com/watch?v=LQjQvN_HXvY)

The next blog of Let's learn Kubernetes would be the last blog of the series' Basics. If you like to learn about other significant topics in Kubernetes, you can follow the previous blogs.