Overview By default, when Artifactory or any other JFrog product is installed on a Kubernetes cluster using Helm-based installation, a Persistent Volume Claim (PVC) is created and mounted to the pod. This is managed by a StatefulSet which controls the creation of the PVC when a Pod is created.
The specification of StatefulSet template defines the parameters for the PVC such as the storage class, access mode, and size. By using this approach, managing storage for stateful applications becomes simpler.
How to increase the size of a PVC?
In order to increase the size of an existing PVC (Persistent Volume Claim) in Kubernetes, you can follow these steps:
Step 1: Edit the YAML file of the PVC: Use kubectl edit pvc <pvc-name> to edit the PVC's YAML file.
Example: If Artifactory is installed using the release name “jfrt” then the PVC will be created with the naming convention “artifactory-volume-jfrt-artifactory-0” when using jfrog/artifactory charts
Step 2:
To modify the size of the PVC locate the spec.resources.requests.storage field and change its value to the desired size in GiB. For example, if you want to increase the size from 20Gi to 30Gi, change spec.resources.requests.storage: 20Gi to spec.resources.requests.storage: 30Gi.
Command: kubectl get pvc -n vigneshs
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE artifactory-volume-jfrt-artifactory-0 Bound pvc-f555ab44-f07b-41dd-a1dd-b39c6c8dce4e 20Gi RWO standard 23m
Command: kubectl edit pvc artifactory-volume-jfrt-artifactory-0 -n vigneshs
# Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: pv.kubernetes.io/bind-completed: "yes" pv.kubernetes.io/bound-by-controller: "yes" volume.beta.kubernetes.io/storage-provisioner: pd.csi.storage.gke.io volume.kubernetes.io/storage-provisioner: pd.csi.storage.gke.io volume.kubernetes.io/storage-resizer: pd.csi.storage.gke.io creationTimestamp: "2023-04-16T08:07:38Z" finalizers: - kubernetes.io/pvc-protection labels: app: artifactory release: jfrt role: artifactory name: artifactory-volume-jfrt-artifactory-0 namespace: vigneshs resourceVersion: "163260809" uid: f555ab44-f07b-41dd-a1dd-b39c6c8dce4e spec: accessModes: - ReadWriteOnce resources: requests: storage: 30Gi storageClassName: standard volumeMode: Filesystem volumeName: pvc-f555ab44-f07b-41dd-a1dd-b39c6c8dce4e status: accessModes: - ReadWriteOnce capacity: storage: 30Gi phase: Bound
Step 3: Save the changes and exit the YAML file. Kubernetes will automatically update the PVC with the new size.
Step 4:
Verify the PVC status: Use kubectl describe pvc <pvc-name> to verify that the PVC status is "Bound" and that the new size is reflected in the output.
Name: artifactory-volume-jfrt-artifactory-0 Namespace: vigneshs StorageClass: standard Status: Bound Volume: pvc-f555ab44-f07b-41dd-a1dd-b39c6c8dce4e Labels: app=artifactory release=jfrt role=artifactory Annotations: pv.kubernetes.io/bind-completed: yes pv.kubernetes.io/bound-by-controller: yes volume.beta.kubernetes.io/storage-provisioner: pd.csi.storage.gke.io volume.kubernetes.io/storage-provisioner: pd.csi.storage.gke.io volume.kubernetes.io/storage-resizer: pd.csi.storage.gke.io Finalizers: [kubernetes.io/pvc-protection] Capacity: 30Gi Access Modes: RWO VolumeMode: Filesystem Used By: jfrt-artifactory-0 Events: <none>
Note that resizing a PVC will trigger a resize operation on the underlying storage volume, which may take some time to complete. Also, not all storage providers support dynamic resizing, so be sure to check your provider's documentation before attempting to resize a PVC.