Issue
-
I want to be able to extend the size of the PVC associated to my controller in CloudBees CI.
-
The field
Jenkins controller Disk Space in GB
is disabled.
Resolution
First of all, you need to determine if the storage class that the PVC is using is properly configured so that it allows volume expansion.
We can verify the value of the property. Following one of the options shown below:
Option 1
-
We need to gather the pvc name:
kubectl describe pod <your_pod_name_here> -n <your_namespace> | grep ClaimName
-
After that, we can get the storage class that you are using:
kubectl describe pvc <claim_name_from_previous_step> -n <your_namespace> | grep ClaimName
-
Finally, we can check if the property is set:
kubectl describe storageclass <your_storage_class> -n <your_namespace>| grep AllowVolumeExpansion
.
Option 2
Use the script shown below:
#!/bin/bash NAMESPACE=<your_namespace> POD=<your_pod_name_here> PVC=$(kubectl -n $NAMESPACE get pod $POD -o jsonpath='{.spec.volumes[?(@.name=="jenkins-home")].persistentVolumeClaim.claimName}') STORAGE=$(kubectl -n $NAMESPACE get pvc $PVC -o jsonpath='{.spec.storageClassName}') kubectl get storageclass $STORAGE -o jsonpath='{.allowVolumeExpansion}'
If the property is set to true, then we are good to continue.
Otherwise, we will get something like:
AllowVolumeExpansion: <unset>
-
If that’s the case, then we will need to edit the storage class and set the property to true.
-
We need to add the property
allowVolumeExpansion: true
to the storage class: -
kubeclt edit storageclass <your_storage_class> -n <your_namespace>
-
The code property has to have the same indentation as shown below:
apiVersion: storage.k8s.io/v1 kind: StorageClass allowVolumeExpansion: true
Once that you have confirmed that the property value is set to true, the next steps would be:
-
In your operations center, edit the controller configuration and set the new volume size.
-
Restart the controller.