Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EliFuzz/ad3e34e6ce8bec09612c3bd5013799f5 to your computer and use it in GitHub Desktop.
Save EliFuzz/ad3e34e6ce8bec09612c3bd5013799f5 to your computer and use it in GitHub Desktop.
Table Overview: Kubernetes Cluster-Scoped Volumes
Type Definition Characteristics Use Cases Best Practices
HostPath Volumes Created and managed using API objects, which can be accessed and modified using kubectl commands. Once a HostPath Volume is created, it can be used to mount a file or directory from the host node's file system into a pod - Local: Data stored on HostPath Volumes is only accessible on the node where the pod is running
- Ephemeral: Data stored on HostPath Volumes is lost when the pod is deleted or the node is restarted
- Risky: HostPath Volumes present many security risks, and it is a best practice to avoid the use of HostPaths when possible
- Testing: useful for testing or development scenarios on a single-node cluster
- Logging: can be used to store log files from the host node or the containers
- Debugging: can be used to access files or directories on the host node for debugging purposes
- Use it only for testing or development on a single-node cluster
- Create the host directory before using it as a HostPath Volume
- Use nodeSelector to ensure the pod is scheduled on the node with the host directory
NodeLocalPV Similar to NodeLocalSSD but provides a more flexible way to manage local storage resources. Instead of attaching a fixed storage device to a worker node, NodeLocalPV allows you to dynamically allocate and deallocate local storage resources as needed - Fast: Data stored on NodeLocalPV is accessed directly from the node's local disk, which reduces latency and improves performance
- Isolated: Each NLPV is dedicated to a single pod, which prevents interference or contention from other pods
- Scalable: NodeLocalPV can be dynamically provisioned and resized as needed, which allows for flexible scaling of storage capacity
- Analytics: ideal for storing analytics data that requires high throughput and low latency
- Machine learning: can be used to store machine learning models and data that need fast and consistent access
- Logging: can store logging data that needs to be collected and processed quickly
- Use it for data that requires high performance and low latency
- Ensure NodeLocalPV are properly configured to match the pod's storage requirements
- Use OpenEBS to monitor and manage NodeLocalPV across nodes and clusters
NodeLocalSSD Type of local storage resource that is attached directly to a worker node. It allows pods to access local storage devices, such as SSDs or NVMe drives, directly from the node. This provides faster access times compared to network-attached storage solutions - Fast: provides high-speed read and write operations for pod data
- Isolated: ensures that only one pod can access a local SSD at a time
- Ephemeral: does not guarantee data persistence across node failures or reboots
- Machine learning: ideal for storing large datasets that need to be processed by machine learning pods
- Analytics: can be used to store intermediate results of data analysis tasks that require low latency
- Caching: can be used to store frequently accessed data that can be regenerated if lost
- Use it for data that is performance-sensitive and can tolerate data loss
- Ensure NodeLocalSSD disks are large enough to accommodate the pod data and have enough free space
- Use multiple NodeLocalSSD disks to balance the I/O load and increase the throughput
Persistent Volumes (PVs) PVs are created and managed using API objects, which can be accessed and modified using kubectl commands. Once a PV is created, it can be used to store data for multiple pods within the same namespace or across namespaces - Persistent: Data stored on PVs persists even if the pods that use them fail or are recreated
- Shared: Multiple pods can access the same PV simultaneously
- Flexible: PVs can be provisioned using various storage technologies
- Databases: PVs are perfect for storing database data that must persist across pod restarts or failures
- File systems: PVs can be used to store file systems that need to be shared among multiple pods
- Config maps: PVs can store configuration files that need to be accessible by multiple pods
- Use PVs for data that must persist across pod restarts or failures
- Ensure PVs are properly sized to accommodate the data they will store
- Use multiple PVs to distribute data across multiple nodes for high availability
StorageClasses Used to classify storage resources in a cluster based on their properties, such as performance, latency, and cost. StorageClasses enable administrators to offer different types of storage services to applications running in the cluster. Developers can then select the appropriate StorageClass for their application's storage needs - Classifies storage resources based on properties like performance, latency, and cost
- Enables administrators to offer differentiated storage services
- Allows developers to choose suitable storage for their applications
- Multi-tenancy: StorageClasses enable multi-tenancy by providing isolated storage services for different applications or teams
- Performance-sensitive workloads: StorageClasses can provide fast storage for performance-sensitive workloads like databases or caching layers
- Cost-optimization: StorageClasses can offer affordable storage options for less critical workloads or archival data
- Create separate StorageClasses for different storage types (e.g., SSD, HDD)
- Configure appropriate storage profiles for each StorageClass (e.g., throughput, IOPS, latency)
- Use StorageClasses to match storage resources with application requirements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment