Quiz Module 6 - Storage and Volumes
Instructions
This quiz contains 30 multiple choice questions.
Question 1
What type of volume is created when a Pod starts and deleted when the Pod terminates?
Show explanation
Correct answer: emptyDir
Explanation: emptyDir is a temporary volume that exists only during the Pod's lifetime.
Question 2
What is a PersistentVolume (PV)?
Show explanation
Correct answer: A storage resource in the cluster that has been provisioned by an administrator
Explanation: A PersistentVolume is a storage resource in the cluster, provisioned manually or dynamically via a StorageClass.
Question 3
What is a PersistentVolumeClaim (PVC)?
Show explanation
Correct answer: A storage request by a user that binds a PV to a Pod
Explanation: A PVC is a storage request that binds a PV to a Pod, allowing users to request storage without knowing the details of the underlying storage.
Question 4
What is the ReadWriteOnce (RWO) access mode?
Show explanation
Correct answer: A single node can mount in read-write mode
Explanation: RWO allows a single node to mount the volume in read-write mode, the most common mode for cloud storage volumes.
Question 5
What is a StorageClass?
Show explanation
Correct answer: A resource that describes storage classes and enables dynamic provisioning of PVs
Explanation: A StorageClass describes available storage classes and enables Kubernetes to automatically create PVs when a PVC is created.
Question 6
What is the default reclaim policy of a StorageClass?
Show explanation
Correct answer: Delete
Explanation: The default policy is Delete, meaning the PV is automatically deleted when the PVC is deleted.
Question 7
What is a StatefulSet?
Show explanation
Correct answer: A workload that manages deployments with stable identities and persistent storage
Explanation: A StatefulSet guarantees stable identities (predictable names) and individual persistent storage for each Pod, ideal for databases.
Question 8
What is the advantage of using an emptyDir volume?
Show explanation
Correct answer: Sharing temporary data between containers in the same Pod
Explanation: emptyDir is useful for sharing temporary files between containers in the same Pod, such as a cache or working files.
Question 9
What is the difference between a PV and a PVC?
Show explanation
Correct answer: A PV is the storage resource, a PVC is the request that binds the PV to a Pod
Explanation: The PV is the storage resource provisioned in the cluster, while the PVC is a user's request that binds the PV to a Pod.
Question 10
What is dynamic provisioning?
Show explanation
Correct answer: Automatic PV creation when a PVC is created, based on a StorageClass
Explanation: Dynamic provisioning allows Kubernetes to automatically create a matching PV when a PVC is created, using a StorageClass.
Question 11
Which access mode allows multiple nodes to mount in read-write mode?
Show explanation
Correct answer: ReadWriteMany
Explanation: ReadWriteMany (RWX) allows multiple nodes to mount the volume in read-write mode simultaneously, necessary for shared file systems like NFS.
Question 12
What is a hostPath volume?
Show explanation
Correct answer: A volume that mounts a file or directory from the host node's filesystem into the Pod
Explanation: hostPath mounts a path from the host node into the Pod. Useful for development but should be avoided in production as it creates node dependency.
Question 13
What is the difference between an emptyDir volume and a tmpfs volume?
Show explanation
Correct answer: emptyDir uses node storage, tmpfs uses RAM
Explanation: emptyDir uses node storage (disk), while tmpfs (emptyDir with medium: Memory) uses RAM, which is faster but limited by available memory.
Question 14
What is a volumeClaimTemplate in a StatefulSet?
Show explanation
Correct answer: A template that automatically creates a PVC for each Pod in the StatefulSet
Explanation: volumeClaimTemplate allows each Pod in a StatefulSet to have its own automatically created PVC with a unique name (e.g., data-web-0, data-web-1).
Question 15
What is the Retain reclaim policy?
Show explanation
Correct answer: The PV is retained even after the PVC is deleted, allowing manual data recovery
Explanation: Retain keeps the PV and its data after the PVC is deleted, useful for data recovery or debugging.
Question 16
What is a Volume Snapshot?
Show explanation
Correct answer: A point-in-time capture of the state of a persistent volume
Explanation: Volume Snapshots allow creating point-in-time backups of volumes, useful for backups and restoration.
Question 17
What is the advantage of using a StorageClass with dynamic provisioning?
Show explanation
Correct answer: Automatic PV creation without manual intervention, simplifying management
Explanation: Dynamic provisioning eliminates the need to manually create PVs, greatly simplifying storage management at scale.
Question 18
What is the command to view PVCs?
Show explanation
Correct answer: kubectl get pvc
Explanation: kubectl get pvc (or persistentvolumeclaim) displays all PVCs and their binding status with PVs.
Question 19
What is an NFS volume?
Show explanation
Correct answer: A volume that mounts an NFS (Network File System) share into the Pod
Explanation: NFS volumes allow mounting network shares, supporting ReadWriteMany for sharing between multiple Pods.
Question 20
What is the difference between a StatefulSet and a Deployment for storage?
Show explanation
Correct answer: StatefulSet guarantees individual persistent storage per Pod with stable identities, Deployment shares storage
Explanation: StatefulSets create a unique PVC for each Pod via volumeClaimTemplate, while Deployments generally share the same storage or have none.
Question 21
What is a CSI (Container Storage Interface) driver?
Show explanation
Correct answer: A standard interface that allows storage plugins to integrate with Kubernetes
Explanation: CSI is a standard interface that allows storage vendors to create plugins to integrate their storage solutions with Kubernetes uniformly.
Question 22
What is the maximum size of a PVC?
Show explanation
Correct answer: Depends on available storage and namespace quotas
Explanation: PVC size is limited by available storage in the cluster and by Resource Quotas defined for the namespace.
Question 23
What is a local volume?
Show explanation
Correct answer: A volume that uses storage directly attached to the node
Explanation: Local volumes use storage directly attached to the node (local disks), offering better performance but with availability constraints.
Question 24
What is the command to view StorageClasses?
Show explanation
Correct answer: kubectl get storageclass
Explanation: kubectl get storageclass (or sc) displays all StorageClasses available in the cluster.
Question 25
What is an ephemeral volume?
Show explanation
Correct answer: A temporary volume that exists only during the Pod's lifetime
Explanation: Ephemeral volumes (like emptyDir) are created with the Pod and deleted when the Pod terminates, not persisting data.
Question 26
What is the difference between a static PV and a dynamic PV?
Show explanation
Correct answer: A static PV is manually created by an administrator, a dynamic PV is automatically created via StorageClass
Explanation: Static provisioning requires manual PV creation, while dynamic provisioning automatically creates PVs via StorageClass when a PVC is created.
Question 27
What is a secret volume?
Show explanation
Correct answer: A volume that mounts Secret data as files in a Pod
Explanation: Secret volumes mount Secret data as files in the Pod, where each key becomes a file with the decoded value.
Question 28
What is the best practice for storage in production?
Show explanation
Correct answer: Use PVs/PVCs with StorageClasses and dynamic provisioning
Explanation: In production, use PVs/PVCs with StorageClasses for persistent storage, avoiding hostPath which creates node dependencies.
Question 29
What is a configMap volume?
Show explanation
Correct answer: A volume that mounts ConfigMap data as files in a Pod
Explanation: ConfigMap volumes mount ConfigMap data as files, where each key becomes a file with the value as content.
Question 30
What is the command to view PVs?
Show explanation
Correct answer: kubectl get pv
Explanation: kubectl get pv (or persistentvolume) displays all PVs and their status (Available, Bound, Released, Failed).
Quiz Results
Congratulations on completing the Module 6 quiz!
Score:
- 25-30 correct answers: Excellent! You have mastered storage and volumes.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on volumes and PVs.
- Less than 15: Recommended to review the module before continuing.
Quiz created: December 2024