pvc.yaml#

# Title: Persistent Volume Claim (PVC) for Shared Data Storage in Weather Forecasting MLOps Platform
# Purpose: Defines a Kubernetes PVC for persistent data storage across application components, enabling shared access to ML artifacts, training data, logs, and synchronized application code in the containerized MLOps environment.
# Owner: MLOps Development Team
# Source: Repository directory k8s/; referenced in docker-compose.yml and prod-docker-compose.yaml for container volume mounting.
# Last-Reviewed: 2025-08-24
# Depends-On: Kubernetes cluster with storage class support; related to Deployment (k8s/deployment.yaml) and Service (k8s/service.yaml) for pod mounting.
# Change-Log: 2025-08-24 - Updated comments for clarity and industry standard compliance; structured header added; no functional changes.
# Links: https://kubernetes.io/docs/concepts/storage/persistent-volumes/; https://k3d.io/v5.4.6/#documentation for k3d-specific configurations.

# API and Kind Definitions
# WHY: Establishes the Kubernetes resource type as a PersistentVolumeClaim for v1 API, enabling persistent storage claims.
apiVersion: v1
kind: PersistentVolumeClaim

# Metadata Section
# WHY: Provides unique identification and organizational context for the PVC within the cluster namespace.
metadata:
  name: data-pvc  # Unique name for PVC; must match volume references in pod specifications.

# Specification Section
# WHY: Defines the storage requirements and access policies to ensure compatibility with development and production environments.
spec:
  # Access Modes
  # Rationale: ReadWriteOnce ensures single-node write access, suitable for k3d demo; consider ReadWriteMany for multi-node production to enable shared access across pods.
  accessModes:
    - ReadWriteOnce

  # Resource Requirements
  # Rationale: Allocates 1Gi storage as a starting point; scales with data growth from weather datasets and ML models to prevent out-of-space errors.
  resources:
    requests:
      storage: 1Gi

  # Storage Class
  # Rationale: 'local-path' is default for k3d development, mapping to host directories for simplicity; for production, switch to distributed options like EBS or NFS for resilience and scalability.
  storageClassName: "local-path"