Scaling the application after installation
Procedure
-
Scale the application to four replicas and expose its services to make the application zone
aware and available.
oc expose svc/file-uploader -n my-shared-storageoc scale --replicas=4 deploy/file-uploader -n my-shared-storageoc get pods -o wide -n my-shared-storageYou should have four file-uploader pods in a few minutes. Repeat the above command until there are 4 file-uploader pods in the
Runningstatus. - Create a PVC and attach it into an application.
oc set volume deploy/file-uploader --add --name=my-shared-storage \ -t pvc --claim-mode=ReadWriteMany --claim-size=10Gi \ --claim-name=my-shared-storage --claim-class=ocs-storagecluster-cephfs \ --mount-path=/opt/app-root/src/uploaded \ -n my-shared-storageThis command:
- Creates a PVC.
- Updates the application deployment to include a volume definition.
- Updates the application deployment to attach a volume mount into the specified mount-path.
- Creates a new deployment with the four application pods.
- Check the result of adding the volume.
oc get pvc -n my-shared-storageExample Output:NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE my-shared-storage Bound pvc-5402cc8a-e874-4d7e-af76-1eb05bd2e7c7 10Gi RWX ocs-storagecluster-cephfs 52sNotice the
ACCESS MODEis set to rwx.All the four
file-uploaderpods are using the same rwx volume. Without this access mode, Red Hat OpenShift does not attempt to attach multiple pods to the same Persistent Volume (PV) reliably. If you attempt to scale up the deployments that are using ReadWriteOnce (RWO) PV, the pods may get colocated on the same node.