We are back again with some quick tips, including Q/A and blog posts on the topics covered in the Day 6 Live sessions, which will help you clear Kubernetes Certifications [CKA/D] and get a better-paid job in the field of Microservices, Containers, DevOps & Kubernetes.
In the last week, i.e. on Day 5 session, we covered Kubernetes Scheduling (Node Selector, Node Affinity and Anti-Affinity, Taint and Toleration), Secrets and Maintenance.
This week of Day 6, we have covered the Introduction to Volume and Persistent Storage with NFS (PV, PVC, Storage Class), Dynamic Volume.
We also covered hands-on Lab 18 out of our 30+ extensive labs.
↦ Know everything about the CKA Certification
So, here are some of the Q/A’s asked from Day 6 Live session
Kubernetes Persistent Storage: Volume, PV, PVC and Storage Class
Kubernetes is a complete containerization orchestration, which provides the ability to run dynamically scaling, management of containerized applications. Persistent Storage in Kubernetes offers applications in K8s a handy way to request and consume storage resources.
↦ Read more about the Kubernetes Persistent Storage: PV, PVC and Storage Class
Q1) What is Kubernetes Volume?
Ans: Containers are immutable means they don’t write data permanently to any storage location, meaning that when a container is deleted, all the data generated during its lifetime also gets deleted. This gives rise to two problems.
One loss of files when the container crashes, and second files can’t be shared between containers. That’s where Kubernetes Volume comes into the picture. At its core, a volume is just a directory, possibly with some data in it, which is accessible to the containers in a pod. It solves both of these problems.
Q2) What are the differences between K8s Volume and Persistent Volume?
Ans: Volume lifecycle is linked to a pod. It gets deleted when the pod gets deleted. At the same time, Persistent Volume has an independent lifecycle. It can exist beyond the lifetime of a pod.
Q3) What are the features of PersistentVolume (PV) ?
- PV is an abstraction for the physical storage device that is attached to the cluster. PV is used to manage durable storage, which needs actual physical storage.
- PV is independent of the lifecycle of the Pods. It means that data represented by a PV continue to exist as the cluster changes and Pods are deleted and recreated.
- PV is not Namespaced; it is available to the whole cluster. i.e. PV is accessible to all namespaces.
- PV is the resource in the cluster that can be provisioned dynamically through PVC, or a cluster administrator can explicitly create it.
- Unlike Volumes, the PVs lifecycle is managed by Kubernetes.
Q4) What are the access mode available for PersistentVolume (PV)?
- ReadWriteOnce(RWO): Volume can be mounted as read-write by a single node.
- ReadOnlyMany(ROX): Volume can be mounted read-only by many nodes.
- ReadWriteMany(RWX): Volume can be mounted as read-write by many nodes.
Q5) What is PersistentVolume (PV) and PersistentVolumeClaim (PVC)?
Ans: In Kubernetes Persistent Storage, a PersistentVolume (PV) is a piece of storage within the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes. The main feature of a PV is that it has an independent life cycle which Kubernetes manage, and it continues to live when the pods accessing it gets deleted.
A PersistentVolumeClaim (PVC) is a request for storage by a user. The claim can include specific storage parameters required by the application. For example, an amount of storage or a specific type of access (RWO – ReadWriteOnce, ROX – ReadOnlyMany, RWX – ReadWriteMany, 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, then it binds the PV to that PVC.
Q6) What are Storage Classes (SC)?
- StorageClass abstracts were the underlying storage provider.
- StorageClass provisions PV dynamically when PVC claims it. StorageClass allows provision volumes dynamically for an incoming claim.
- StorageClass is used in conjunction with PVC that allows Pods to request new storage dynamically.
- StorageClass uses provisioners specific to the storage platform or cloud provider to give Kubernetes access to the physical storage.
- Each storage backend has its provisioner. Storage Backend is defined in the StorageClass component via the provisioner attribute.
Q7) What is the reclaim policy in Storage Classes (SC)?
- PV is dynamically created by a StorageClass will have the reclaim policy specified in the reclaimPolicy field of the class, which can be either Delete or Retain.
- If no reclaimPolicy is specified when a StorageClass object is created, it will default to Delete.
- PV that are created manually and managed via a StorageClass will have whatever reclaim policy they were assigned at creation.
- The reclaim policy applies to the persistent volumes, not to the storage class itself. PVs and PVCs that are created using that StorageClass will inherit the reclaim policy set in StorageClass.
Volume implementations are configured through StorageClass resources.
If you set up a Kubernetes cluster on GCP, AWS, Azure, or any other cloud platform, a default StorageClass creates for you which uses the standard persistent disk type.
Q8) What is NFS in Kubernetes?
Ans: One of the most useful types of volumes in Kubernetes is NFS.
NFS stands for Network File System – it’s a shared filesystem that can be accessed over the network. The NFS must already exist – Kubernetes doesn’t run the NFS; pods just access it.
An NFS is valid for two reasons.
- One, what’s already stored in the NFS is not deleted when a pod is destroyed. Data is persistent.
- Two, an NFS can be accessed from multiple pods at the same time. An NFS can be used to share data between pods!
This is useful for running applications that need a filesystem that’s shared between multiple application servers. You can use an NFS to run WordPress on Kubernetes!
Q9) What is Dynamic Provisioning?
Ans: When none of the static PVs matches a user’s PersistentVolumeClaim, the cluster may try to provision a volume, especially for the PVC dynamically.
This provisioning is based on StorageClasses, the PVC must request a storage class, and the administrator must have created and configured that class for dynamic provisioning to occur.
Check Out: Our blog post on Kubernetes Statefulset.
Quiz Time (Sample Exam Questions)!
With the CKA training program, we will cover 100+ sample exam questions to help you prepare for CKA certification. Check out the questions and see if you can solve this.
Ques) What is a Kubernetes volume?
A. The software within an OS that controls capacity allocation for nodes
B. A directory for the data accessible to containers in a pod
C. Layering software that puts apps into compartments for easier deployment
D. Code that enables two software programs to communicate
The correct answer will be revealed in my next week’s blog
Here is the answer to the question shared last week
Ques) Which of the below taint effects are possible which can be applied to a node?
A. NoSchedule
B. PreferNoSchedule
C. NoExecute
D. All of the above
Answer: D
Explanation: NoSchedule, PreferNoSchedule and NoExecute are the three types of possible taint effects.
Feedback
We always work on improving and being the best version of ourselves from the previous session hence constantly ask feedback from our attendees. Here’s the feedback that we received from our trainees who had attended the session…
Related Post
- How To Setup A Three Node Kubernetes Cluster For CKA: Step By Step
- CKA Certification Exam (Certified Kubernetes Administrator)
- Kubernetes Architecture: An Introduction to Kubernetes Components
- Kubernetes Ingress Controller Examples with Best Option
- [Recap] Day 5 – K8s Scheduling, Secrets, Node Maintenance [CKA] [Certified Kubernetes Administrator]
Join FREE Class
Begin your journey towards becoming a Certified Kubernetes Administrator [CKA] from our Certified Kubernetes Administrator (CKA) training program. To know about the Roles and Responsibilities of a Kubernetes administrator, why learn Docker and Kubernetes, Job opportunities for Kubernetes administrator in the market, Hands-On labs you must perform to clear the Certified Kubernetes Administrator (CKA) Certification exam by registering for our FREE class.
Leave a Reply