Increase Replica With Volume of Arbitrary Size With K8s Stateful Set
Statefulset is deployed,
volumeClaimTemplates etc. cannot be changed. However, there is a way to change the Volume.
As a result, the volume size in
volumeClaimTemplates on the code and the size actually used are different. In that state, if you try to Scale, the volume and size that have already been expanded will be different, and the balance will be lost.
- Create PVC according to the naming convention of pvc generated by Volume size + statefulset
- Scale out
The pvc created from VolumeClaimTemplate is,
<volumeClaimTemplateName>-<pod_name>so in this case it was test-storage-4-testing.
accessModes: [ "ReadWriteOnce" ]
At this time, if
volumeBindingMode: WaitForFirstConsumer you are using it, wait until the pod claims and the following message appears
Normal WaitForFirstConsumer 11s (x3 over 20s) persistentvolume-controller waiting for first consumer to be created before binding
by the author.