Managing persistent volume sizes for Watson OpenScale
Manage persistent volumes to control data storage for Watson OpenScale.
Manage etcd persistent volumes with support
- Log in to Red Hat OpenShift Container platform with the following command:
oc login <OpenShift_URL>:<port> - Pause the Watson
OpenScale operator reconciliation of
the Watson
OpenScale custom resource:
instanceProjectName='cpd-instance' oc patch WOService aiopenscale -n ${instanceProjectName} --type merge --patch '{"spec": {"ignoreForMaintenance": true}}'If you did not install Cloud Pak for Data in the
cpd-instanceproject, specify accurate values in theinstanceProjectNamefield. - Delete the
etcd statefulsetcluster with the following command:oc delete sts aiopenscale-ibm-aios-etcd -n ${instanceProjectName} - Customize the size of the
etcdpersistent volumes with the following command:targetPVCSize=8Gi oc patch WOServiceConfig aiopenscale -n ${instanceProjectName} --type merge --patch '{"spec": {"aios_etcd": {"pvc": {"size": "'${targetPVCSize}'"}}}}'The default size value is
4GI. - Change the size of the
etcdpersistent volume claim (PVC) objects with the following commands:oc patch pvc data-aiopenscale-ibm-aios-etcd-0 -n ${instanceProjectName} --type merge --patch '{"spec":{"resources":{"requests":{"storage":"'${targetPVCSize}'"}}}}' oc patch pvc data-aiopenscale-ibm-aios-etcd-1 -n ${instanceProjectName} --type merge --patch '{"spec":{"resources":{"requests":{"storage":"'${targetPVCSize}'"}}}}' oc patch pvc data-aiopenscale-ibm-aios-etcd-2 -n ${instanceProjectName} --type merge --patch '{"spec":{"resources":{"requests":{"storage":"'${targetPVCSize}'"}}}}' - Resume the Watson
OpenScale operator reconciliation of
the Watson
OpenScale custom resource:
oc patch WOService aiopenscale -n ${instanceProjectName} --type merge --patch '{"spec": {"ignoreForMaintenance": false}}' - Check the status of the reconciliation with the following command:
oc get WOService aiopenscale -n ${instanceProjectName} -o jsonpath='{.status.wosStatus} {"\n"}'The status of the custom resources changes to
Completedwhen the reconciliation finishes successfully. - After the reconciliation completes, verify that the
etcdPVCs are resized with the following command:oc get pvc -n ${instanceProjectName} | grep data-aiopenscale-ibm-aios-etcd
Manage etcd persistent volumes without support
- Log in to Red Hat OpenShift Container platform with the following command:
oc login <OpenShift_URL>:<port> - Pause the Watson
OpenScale operator reconciliation of
the Watson
OpenScale custom resource:
instanceProjectName='cpd-instance' oc patch WOService aiopenscale -n ${instanceProjectName} --type merge --patch '{"spec": {"ignoreForMaintenance": true}}'If you did not install Cloud Pak for Data in the
cpd-instanceproject, specify accurate values in theinstanceProjectNamefield. - Scale down the
etcd Statefulsetcluster:oc scale sts aiopenscale-ibm-aios-etcd -n ${instanceProjectName} --replicas=0 - Change the
persistentVolumeReclaimPolicyspecification toRetainin all of theetcdpersistent volume claim (PVC) objects with the following command:etcd_0_pv=`oc get pvc data-aiopenscale-ibm-aios-etcd-0 -n ${instanceProjectName} -o jsonpath='{.spec.volumeName}'` oc patch pv ${etcd_0_pv} -n ${instanceProjectName} -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' etcd_1_pv=`oc get pvc data-aiopenscale-ibm-aios-etcd-1 -n ${instanceProjectName} -o jsonpath='{.spec.volumeName}'` oc patch pv ${etcd_1_pv} -n ${instanceProjectName} -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' etcd_2_pv=`oc get pvc data-aiopenscale-ibm-aios-etcd-2 -n ${instanceProjectName} -o jsonpath='{.spec.volumeName}'` oc patch pv ${etcd_2_pv} -n ${instanceProjectName} -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'The command prevents the
etcdPVC objects from being deleted. - Customize the
etcdpersistent volume sizes:targetPVCSize=8Gi oc patch WOServiceConfig aiopenscale -n ${instanceProjectName} --type merge --patch '{"spec": {"aios_etcd": {"pvc": {"size": "'${targetPVCSize}'"}}}}'The default size value is
4GI. - Create temporary backup of
etcdPVC objects with the following command:etcdStorageClass=`oc get pvc data-aiopenscale-ibm-aios-etcd-0 -o jsonpath='{.spec.storageClassName}'` cat <<EOF |oc apply -f - --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: aiopenscale-etcd-backup-pvc-0 namespace: ${instanceProjectName} spec: accessModes: - ReadWriteOnce resources: requests: storage: ${targetPVCSize} storageClassName: ${etcdStorageClass} volumeMode: Filesystem --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: aiopenscale-etcd-backup-pvc-1 namespace: ${instanceProjectName} spec: accessModes: - ReadWriteOnce resources: requests: storage: ${targetPVCSize} storageClassName: ${etcdStorageClass} volumeMode: Filesystem --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: aiopenscale-etcd-backup-pvc-2 namespace: ${instanceProjectName} spec: accessModes: - ReadWriteOnce resources: requests: storage: ${targetPVCSize} storageClassName: ${etcdStorageClass} volumeMode: Filesystem EOFThe backup objects provide intermediate storage to complete resizing.
- Create a job to copy the original
etcddata to the backup PVC objects with the following command:operatorProjectName='cpd-operator' operatorPod=`oc get pod -n ${operatorProjectName} | grep wos | awk '{ printf("%s", $1) }'` aiosKubectlImageDigest=`oc exec ${operatorPod} -n ${operatorProjectName} -- cat config-vars/images/images-x86_64.yaml | grep -A 1 aios_kubectl | grep digest | awk '{ printf("%s", $2) }' | tr -d '"'` cat <<EOF |oc apply -f - apiVersion: batch/v1 kind: Job metadata: name: backup-etcd-data-job spec: template: metadata: name: backup-etcd-data-job namespace: ${instanceProjectName} spec: serviceAccountName: zen-norbac-sa hostNetwork: false hostPID: false hostIPC: false securityContext: runAsNonRoot: true runAsGroup: 1000321421 restartPolicy: Never containers: - name: backup-etcd-data-job image: cp.icr.io/cp/cpd/aios-kubectl@${aiosKubectlImageDigest} command: - "/bin/sh" - "-ec" - | echo "COPY FILES FROM ETCD DATA PVC TO BACKUP PVC" cp -r /data-0/* /backup-0 cp -r /data-1/* /backup-1 cp -r /data-2/* /backup-2 echo echo "POST COPY - PRINT LIST OF FILES IN ETCD BACKUP PVC" echo "backup-0 ..." ls -ltrR /backup-0 echo "backup-1 ..." ls -ltrR /backup-1 echo "backup-2 ..." ls -ltrR /backup-2 volumeMounts: - name: backup-0 mountPath: "/backup-0" - name: data-0 mountPath: "/data-0" - name: backup-1 mountPath: "/backup-1" - name: data-1 mountPath: "/data-1" - name: backup-2 mountPath: "/backup-2" - name: data-2 mountPath: "/data-2" volumes: - name: backup-0 persistentVolumeClaim: claimName: aiopenscale-etcd-backup-pvc-0 - name: data-0 persistentVolumeClaim: claimName: data-aiopenscale-ibm-aios-etcd-0 - name: backup-1 persistentVolumeClaim: claimName: aiopenscale-etcd-backup-pvc-1 - name: data-1 persistentVolumeClaim: claimName: data-aiopenscale-ibm-aios-etcd-1 - name: backup-2 persistentVolumeClaim: claimName: aiopenscale-etcd-backup-pvc-2 - name: data-2 persistentVolumeClaim: claimName: data-aiopenscale-ibm-aios-etcd-2 EOFIf you did not install Cloud Pak for Data in the
cpd-instanceproject, specify accurate values in theinstanceProjectNamefield. - Verify that the
etcddata is backed up by inspecting thebackup-etcd-data-jobjob pod logs with the following command:backupEtcdDataJobPod=`oc get pod -n ${instanceProjectName} -l job-name=backup-etcd-data-job | awk 'NR>1 { printf("%s", $1) }'` oc logs -f pod/${backupEtcdDataJobPod} -n ${instanceProjectName} - Delete the backup job with the following command:
oc delete job -l job-name=backup-etcd-data-job -n ${instanceProjectName} - Delete the original
etcddata PVC objects with the following command:oc delete pvc data-aiopenscale-ibm-aios-etcd-0 oc patch pv ${etcd_0_pv} --type json -p '[{"op": "remove", "path": "/spec/claimRef"}]' oc delete pvc data-aiopenscale-ibm-aios-etcd-1 oc patch pv ${etcd_1_pv} --type json -p '[{"op": "remove", "path": "/spec/claimRef"}]' oc delete pvc data-aiopenscale-ibm-aios-etcd-2 oc patch pv ${etcd_2_pv} --type json -p '[{"op": "remove", "path": "/spec/claimRef"}]'The command does not delete the underlying PV objects.
- Recreate the resized
etcddata PVC objects with the following command:cat <<EOF |oc apply -f - --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: data-aiopenscale-ibm-aios-etcd-0 namespace: ${instanceProjectName} spec: accessModes: - ReadWriteOnce resources: requests: storage: ${targetPVCSize} storageClassName: ${etcdStorageClass} volumeMode: Filesystem --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: data-aiopenscale-ibm-aios-etcd-1 namespace: ${instanceProjectName} spec: accessModes: - ReadWriteOnce resources: requests: storage: ${targetPVCSize} storageClassName: ${etcdStorageClass} volumeMode: Filesystem --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: data-aiopenscale-ibm-aios-etcd-2 namespace: ${instanceProjectName} spec: accessModes: - ReadWriteOnce resources: requests: storage: ${targetPVCSize} storageClassName: ${etcdStorageClass} volumeMode: Filesystem EOF - Create a job to restore
etcddata from backup PVC objects to resizedetcdPVC objects with the following command:cat <<EOF |oc apply -f - apiVersion: batch/v1 kind: Job metadata: name: restore-etcd-data-job spec: template: metadata: name: restore-etcd-data-job namespace: ${instanceProjectName} spec: serviceAccountName: zen-norbac-sa hostNetwork: false hostPID: false hostIPC: false securityContext: runAsNonRoot: true runAsGroup: 1000321421 restartPolicy: Never containers: - name: restore-etcd-data-job image: cp.icr.io/cp/cpd/aios-kubectl@${aiosKubectlImageDigest} command: - "/bin/sh" - "-ec" - | echo "COPY FILES FROM ETCD BACKUP PVC TO DATA PVC" cp -r /backup-0/* /data-0 cp -r /backup-1/* /data-1 cp -r /backup-2/* /data-2 echo echo "POST COPY - PRINT LIST OF FILES IN ETCD DATA PVC" echo "data-0 ..." ls -ltrR /data-0 echo "data-1 ..." ls -ltrR /data-1 echo "data-2 ..." ls -ltrR /data-2 volumeMounts: - name: backup-0 mountPath: "/backup-0" - name: data-0 mountPath: "/data-0" - name: backup-1 mountPath: "/backup-1" - name: data-1 mountPath: "/data-1" - name: backup-2 mountPath: "/backup-2" - name: data-2 mountPath: "/data-2" volumes: - name: backup-0 persistentVolumeClaim: claimName: aiopenscale-etcd-backup-pvc-0 - name: data-0 persistentVolumeClaim: claimName: data-aiopenscale-ibm-aios-etcd-0 - name: backup-1 persistentVolumeClaim: claimName: aiopenscale-etcd-backup-pvc-1 - name: data-1 persistentVolumeClaim: claimName: data-aiopenscale-ibm-aios-etcd-1 - name: backup-2 persistentVolumeClaim: claimName: aiopenscale-etcd-backup-pvc-2 - name: data-2 persistentVolumeClaim: claimName: data-aiopenscale-ibm-aios-etcd-2 EOF - Verify that the
etcddata is restored by inspecting therestore-etcd-data-jobjob pod logs with the following command:restoreEtcdDataJobPod=`oc get pod -n ${instanceProjectName} -l job-name=restore-etcd-data-job | awk 'NR>1 { printf("%s", $1) }'` oc logs -f pod/${restoreEtcdDataJobPod} -n ${instanceProjectName} - Delete the
restorejob with the following command:oc delete job -l job-name=restore-etcd-data-job -n ${instanceProjectName} - Delete the
etcd statefulsetcluster with the following command:oc delete sts aiopenscale-ibm-aios-etcd -n ${instanceProjectName} - Resume the Watson
OpenScale operator reconciliation of
the Watson
OpenScale custom resource:
oc patch WOService aiopenscale -n ${instanceProjectName} --type merge --patch '{"spec": {"ignoreForMaintenance": false}}' - Check the status of the reconciliation with the following command:
oc get WOService aiopenscale -n ${instanceProjectName} -o jsonpath='{.status.wosStatus} {"\n"}'The status of the custom resources changes to
Completedwhen the reconciliation finishes successfully. - After the reconciliation completes, verify that the
etcdPVCs are resized with the following command:oc get pvc -n ${instanceProjectName} | grep data-aiopenscale-ibm-aios-etcd
Increase Kafka persistent volumes
- Move the Watson
OpenScale custom resource to
maintenancewith the following command:oc patch WOService aiopenscale --type merge --patch '{"spec": {"ignoreForMaintenance": true}}' - Scale down the Kafka
StatefulSetcluster with the following command:oc scale sts aiopenscale-ibm-aios-kafka --replicas=0 - Delete all of the Watson
OpenScale persistent volume
claim (PVC) objects:
oc delete pvc data-aiopenscale-ibm-aios-kafka-0 data-aiopenscale-ibm-aios-kafka-1 data-aiopenscale-ibm-aios-kafka-2 - Delete the Kafka
StatefulSetcluster with the following command:oc delete sts aiopenscale-ibm-aios-kafka - Specify a new size for the Kafka persistent volume storage with the following command:
oc patch WOServiceConfig aiopenscale --type merge --patch '{"spec": {"aios_kafka": {"pvc": {"size": "4Gi"}}}}'The default size is
1Gi. - Scale down all of the Watson
OpenScale micro-service
deployments with the following command:
oc scale deployment -l "component in (aios-bias,aios-bkpi,aios-common,aios-configuration,aios-dashboard,aios-datamart,aios-drift,aios-explainability,aios-fast,aios-feedback,aios-ml,aios-mrm,aios-notification,aios-payload,aios-scheduling)" --replicas=0 - Move the Watson
OpenScale custom resource out of
maintenance with the following command:
oc patch WOService aiopenscale --type merge --patch '{"spec": {"ignoreForMaintenance": false}}' - Check the status of the reconciliation with the following command:
oc get WOService aiopenscaleThe status of the custom resource changes to
Completedwhen the reconciliation finishes successfully.
Reset Kafka persistent volumes
- Move the Watson
OpenScale custom resource to
maintenancewith the following command:oc patch WOService aiopenscale --type merge --patch '{"spec": {"ignoreForMaintenance": true}}' - Scale down the Kafka
StatefulSetcluster with the following command:oc scale sts aiopenscale-ibm-aios-kafka --replicas=0 - Delete all of the Watson
OpenScale persistent volume
claim (PVC) objects:
oc delete pvc data-aiopenscale-ibm-aios-kafka-0 data-aiopenscale-ibm-aios-kafka-1 data-aiopenscale-ibm-aios-kafka-2 - Scale down all of the Watson
OpenScale micro-service
deployments with the following command:
oc scale deployment -l "component in (aios-bias,aios-bkpi,aios-common,aios-configuration,aios-dashboard,aios-datamart,aios-drift,aios-explainability,aios-fast,aios-feedback,aios-ml,aios-mrm,aios-notification,aios-payload,aios-scheduling)" --replicas=0 - Move the Watson
OpenScale custom resource out of
maintenance with the following command:
oc patch WOService aiopenscale --type merge --patch '{"spec": {"ignoreForMaintenance": false}}' - Check the status of the reconciliation with the following command:
oc get WOService aiopenscaleThe status of the custom resource changes to
Completedwhen the reconciliation finishes successfully.