Repositories
v1v
Published by: Kubernetes0Updated

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.

v1
configmap
persistentvolume
persistentvolumeclaim
|

Authentication

Add API authentication details

HEADERS
X-APIKEY
string
Send X-APIKEY in Header

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

  1. 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"
    ]
}
  1. 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"
    ]
}
  1. 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"
    ]
}
  1. 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"
    ]
}
  1. Flexibility: The use of the __PV_ID__ variable allows for dynamic population of all PersistentVolume fields.

  2. 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 -
POST/apis/repos/kubernetes/config-and-storage-resources/v1/resources/collections/persistent-volume/exec
REQUEST
QUERY-STRING PARAMETERS
format
string
No sources available.
API Server https://configfacets.com
API Key
Not set
RESPONSES
No content available.