Managing Persistent Volumes in Your Deployment

Managing Persistent Volumes in Your Deployment

What are Persistent Volumes in k8s

In Kubernetes (k8s), a Persistent Volume (PV) is a cluster-wide piece of storage in the cluster that has a lifecycle independent of any individual pod that uses the PV. It serves as a way to decouple the definition of storage from the pod using it. Persistent Volumes are resources in the cluster just like nodes and can be dynamically provisioned or pre-provisioned by an administrator.

Here are some key concepts related to Persistent Volumes in Kubernetes:

  1. Storage Classes:Kubernetes provides a concept called "Storage Classes" which are used to define different classes of storage with different performance characteristics.Storage Classes are used by Persistent Volume Claims (PVCs) to request dynamic provisioning of Persistent Volumes.
  2. Persistent Volume Claims (PVCs):A Persistent Volume Claim is a request for storage by a user.When a user creates a PVC, it requests storage with specific requirements (e.g., size, access mode) using a Storage Class.If a suitable Persistent Volume is available, it is bound to the claim. If not, and dynamic provisioning is enabled, a new Persistent Volume may be dynamically provisioned.
  3. Access Modes:Persistent Volumes have access modes that define how the storage can be accessed by pods. The three common access modes are ReadWriteOnce, ReadOnlyMany, and ReadWriteMany.ReadWriteOnce: The volume can be mounted as read-write by a single node.ReadOnlyMany: The volume can be mounted as read-only by many nodes.ReadWriteMany: The volume can be mounted as read-write by many nodes.
  4. Reclaim Policies:When a Persistent Volume is released (i.e., the associated claim is deleted), the data on the volume can be retained or deleted based on the reclaim policy.The two common reclaim policies are Retain and Delete.Retain: The volume is not automatically deleted. It is the responsibility of the administrator to manually reclaim the resources.Delete: The volume is automatically deleted when the associated claim is deleted.
  5. Dynamic Provisioning:Dynamic provisioning is a feature in Kubernetes that allows storage volumes to be automatically provisioned when a PVC is created.The storage class specifies the provisioner, which is responsible for creating the volume. This allows for on-demand creation of volumes based on the storage class definition.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: standard
  resources:
    requests:
      storage: 5Gi        


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

Daniel Gurus的更多文章

  • Why prefer Kubernetes ?

    Why prefer Kubernetes ?

    Kubernetes has become a cornerstone in modern container orchestration and management for a variety of reasons. Its…

    3 条评论
  • AWS EC2 Automation

    AWS EC2 Automation

    Instance Types General Purpose Instances (e.g.

  • AWS and IAM Basics

    AWS and IAM Basics

    AWS Identity and Access Management (IAM) is a web service provided by Amazon Web Services (AWS) that enables you to…

    2 条评论
  • Mastering ConfigMaps and Secrets in Kubernetes

    Mastering ConfigMaps and Secrets in Kubernetes

    What are ConfigMaps and Secrets in k8s ConfigMaps: ConfigMaps are Kubernetes resources that allow you to decouple…

  • Mastering Docker Best Practices: A DevOps Engineer's Guide

    Mastering Docker Best Practices: A DevOps Engineer's Guide

    Introduction: In the ever-evolving landscape of software development and deployment, Docker has emerged as a…

  • Devops Best Practices for Seamless Integration

    Devops Best Practices for Seamless Integration

    Introduction: In today's fast-paced tech world, the need for efficient collaboration between development and operations…

    1 条评论
  • Working with Services in Kubernetes

    Working with Services in Kubernetes

    What are Services in K8s In Kubernetes (K8s), a service is an abstraction that defines a logical set of pods and a…

  • Working with Namespaces and Services in Kubernetes

    Working with Namespaces and Services in Kubernetes

    What are Namespaces and Services in k8s A Namespace in Kubernetes is a way to partition cluster resources. It allows…

  • Basic networking concepts for Devops engineer

    Basic networking concepts for Devops engineer

    Here are some fundamental networking concepts that are important for a DevOps engineer: IP Addressing: IPv4 and IPv6:…

    3 条评论
  • Launching your Kubernetes Cluster with Deployment

    Launching your Kubernetes Cluster with Deployment

    What is Deployment in k8s? A Kubernetes Deployment is an API resource that provides a declarative way to define the…

社区洞察

其他会员也浏览了