Difference between revisions of "Kubectl patch pvc"

From wikieduonline
Jump to navigation Jump to search
Line 10: Line 10:
 
  Solution: ensure your [[StorageClass]] has [[AllowVolumeExpansion]]:  True defined. Can be modified or added without loosing data.
 
  Solution: ensure your [[StorageClass]] has [[AllowVolumeExpansion]]:  True defined. Can be modified or added without loosing data.
  
 +
[[Minikube]]
 +
kubectl -n default patch pvc data-my-mariadb-0 -p '{"spec":{"resources":{"requests":{"storage":"16Gi"}}}}'
 +
Error from server (Forbidden): persistentvolumeclaims "data-my-mariadb-0" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize
  
  

Revision as of 18:51, 22 October 2023

To increase size in a pvc, decrease size is not suppported:

kubectl patch pvc elasticsearch-master-elasticsearch-master-0 -p '{"spec":{"resources":{"requests":{"storage":"35Gi"}}}}'
persistentvolumeclaim/elasticsearch-master-elasticsearch-master-0 patched
kubectl patch pvc elasticsearch-master-elasticsearch-master-1 -p '{"spec":{"resources":{"requests":{"storage":"35Gi"}}}}'
Error from server (Forbidden): persistentvolumeclaims "elasticsearch-master-elasticsearch-master-1" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize

Solution: ensure your StorageClass has AllowVolumeExpansion:  True defined. Can be modified or added without loosing data.

Minikube

kubectl -n default patch pvc data-my-mariadb-0 -p '{"spec":{"resources":{"requests":{"storage":"16Gi"}}}}'

Error from server (Forbidden): persistentvolumeclaims "data-my-mariadb-0" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize


kubectl describe sc standard| grep AllowVolumeExpansion
AllowVolumeExpansion:  True


Related

Activities

See also

Advertising: