Config and Storage Resources - v1 provides a comprehensive suite of templates for Kubernetes configuration and storage resources, including PersistentVolume, PersistentVolumeClaim, ConfigMap, Secret, and StorageClass. These templates enable efficient management of persistent storage and configuration data within clusters.
Authentication
Add API authentication details
Readme
User instructions for this resource
The PersistentVolume template in ConfigFacets is designed to create and manage Kubernetes PersistentVolume resources, which represent pieces of storage in the cluster.
Key aspects of the template design
- Modularity: The template is divided into multiple sections, each with its own facet, allowing for flexible configuration of different storage types. For example:
{
"spec": {
"nfs": {
"path": "{{ __PV_ID__.spec.nfs.path }}",
"server": "{{ __PV_ID__.spec.nfs.server }}"
}
},
"facets": [
"addon:spec",
"addon:nfs"
]
}
- Core Specifications: The basic PV specifications (capacity, access modes, reclaim policy) are included in the main "addon:spec" facet:
{
"spec": {
"capacity": {
"storage": "{{ __PV_ID__.spec.capacity.storage }}"
},
"accessModes": "{{ __PV_ID__.spec.accessModes }}",
"persistentVolumeReclaimPolicy": "{{ __PV_ID__.spec.persistentVolumeReclaimPolicy }}"
},
"facets": [
"addon:spec"
]
}
- Storage Class Support: A separate facet for storage class allows easy classification of the PV:
{
"spec": {
"storageClassName": "{{ __PV_ID__.spec.storageClassName }}"
},
"facets": [
"addon:spec",
"addon:storageclass"
]
}
- Multiple Storage Types: The template includes facets for various storage backends (NFS, HostPath, AWS EBS, GCE PD, Azure Disk), enabling support for different infrastructure environments. For instance:
{
"spec": {
"gcePersistentDisk": {
"fsType": "{{ __PV_ID__.spec.gcePersistentDisk.fsType }}",
"pdName": "{{ __PV_ID__.spec.gcePersistentDisk.pdName }}"
}
},
"facets": [
"addon:spec",
"addon:gcepd"
]
}
Flexibility: The use of the
variable allows for dynamic population of all PersistentVolume fields.__PV_ID__
Extensibility: The facet-based approach allows for easy addition of new storage types or PV features in future Kubernetes versions.
Examples
Check Request Body tab section to play around with interactive examples.
Install(
)Example
The Curl tab in the request section below provides the curl command for your resource.
curl -s -X POST "https://configfacets.com/apis/repos/kubernetes/config-and-storage-resources/v1/resources/collections/persistent-volume/exec?format=json" -d '{"facets":["master","addon:spec","addon:storageclass","addon:nfs"],"values":{"nfs_pv":{"spec":{"nfs":{"path":"/tmp","server":"172.17.0.2"},"capacity":{"storage":"5Gi"},"accessModes":["ReadWriteOnce"],"storageClassName":"slow","persistentVolumeReclaimPolicy":"Recycle"},"metadata":{"name":"nfs-pv"}}},"globalvars":{"__PV_ID__":"nfs_pv"}}' | kubectl apply -f -