Jenkins Persistence and Storage Configuration¶
Jenkins Persistence and Storage Configuration defines how the Jenkins controller stores data, configurations, and build artifacts. In containerized environments (like Kubernetes), this is typically managed through Persistent Volume Claims (PVCs) to ensure data survives pod restarts^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].
Core Persistence Parameters¶
These parameters control the primary storage volume for the Jenkins home directory (/var/jenkins_home^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]).
persistence.enabled: Enables the creation of a Persistent Volume Claim (PVC) for the Jenkins controller^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]. Default istrue.persistence.existingClaim: If set, this parameter specifies the name of an already existing PVC to use, rather than creating a new one^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].persistence.storageClass: Defines the StorageClass to use for the PVC^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]. If not set (nil), the cluster's default StorageClass is typically used.persistence.size: Specifies the size of the requested persistent volume^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]. Default is8Gi.persistence.accessMode: Sets the access mode for the PVC^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]. Default isReadWriteOnce.
Advanced Configuration¶
Additional settings allow for finer-grained control over volume metadata and behavior.
persistence.annotations: Allows adding custom annotations to the PVC^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].persistence.labels: Allows adding custom labels to the PVC^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].persistence.subPath: Defines a sub-path within the volume to mount Jenkins Home to^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].
Additional Volumes and Mounts¶
Beyond the primary storage, extra volumes can be attached to the controller.
persistence.volumes: A list of additional volume specifications to be added to the controller pod^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].persistence.mounts: A list of additional volume mount specifications, defining where the extra volumes are mounted inside the container^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].
Interaction with Initialization Logic¶
Persistence configuration is linked to how Jenkins initializes and updates its environment, particularly regarding plugins.
controller.initializeOnce: When set totrue, this parameter ensures that initialization scripts only run on the first install^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]. This prevents plugins from being updated inadvertently on subsequent deployments.- Constraint: This setting specifically requires
persistence.enabledto be set totrueto function correctly^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md].
- Constraint: This setting specifically requires
Related Concepts¶
- [[流程化筆記]]: Can be used to document the specific steps for creating and managing the storage infrastructure.
- 20/80 Learning Principle: Useful for prioritizing which storage features (e.g., backups vs. snapshots) to learn and configure first.
Sources¶
^[400-devops__06-Kubernetes__devops-helm__helm-jenkins__VALUES_SUMMARY.md]