All Content for $129 / ₹9,999 (3 Days Left)
Imagine you're ordering a pizza. You want to choose the size, the crust type, the toppings, etc. Storage Classes are like your pizza order for your Kubernetes storage. They let you define the exact type of storage you want for your applications.
Here's how they work:
Define Storage Provisioning Parameters:
Used by Users to Request Specific Storage Configurations:
Example
Let's imagine we have two Storage Classes:
Code Example:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: fast-disk
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
encrypted: "true"
reclaimPolicy: Delete
accessModes:
- ReadWriteOnce
This code defines a Storage Class called "fast-disk" using Amazon Elastic Block Storage (EBS). It specifies that it uses the gp2 storage type (SSD), is encrypted, and has a reclaim policy of "Delete".
Points to remember:
Multiple-Choice Questions:
1. What is a Storage Class used for in Kubernetes?
* A. It defines the size of the storage volume you need.
* B. It defines the network bandwidth for your pods.
* C. **It defines the provisioning parameters for your storage volumes.**
* D. It defines the number of pods that can access a particular storage volume.
**Reason:** Storage Classes define the overall characteristics of a storage volume, not just its size or access.
2. You are deploying a database application that requires fast access to data. Which of the following Storage Class parameters would be most relevant in this scenario?
* A. Reclaim Policy
* B. Access Mode
* C. **Storage Type**
* D. Provisioner
**Reason:** The storage type directly impacts performance. Choosing a Storage Class with SSDs will provide faster access.
3. You have a Storage Class defined with a reclaim policy of "Delete". What happens when a Persistent Volume Claim (PVC) using this Storage Class is deleted?
* A. The PVC is deleted, but the underlying storage volume persists.
* B. **The PVC and the underlying storage volume are deleted.**
* C. The PVC is deleted, and the underlying storage volume is archived.
* D. The PVC is deleted, and the underlying storage volume is made available for other PVCs.
**Reason:** A reclaim policy of "Delete" means that the underlying storage volume is removed when the PVC is deleted.
4. You have a Storage Class called "standard-disk" defined with a provisioner of "kubernetes.io/gce-pd". Which cloud provider does this Storage Class likely target?
* A. Amazon Web Services (AWS)
* B. Microsoft Azure
* C. **Google Cloud Platform (GCP)**
* D. OpenStack
**Reason:** The provisioner "kubernetes.io/gce-pd" is specific to Google Cloud Platform's Persistent Disks.
5. You have a Storage Class defined with an access mode of "ReadWriteOnce". Which of the following scenarios is NOT possible with this Storage Class?
* A. A single pod mounts the storage volume.
* B. Multiple pods mount the storage volume, but only one can write to it at a time.
* C. **Multiple pods can mount the storage volume and write to it concurrently.**
* D. A pod mounts the storage volume in read-only mode.
**Reason:** ReadWriteOnce means that only one pod can write to the volume at a time, preventing concurrent writes from multiple pods.