How to resize Insights data pvc?
Issue:
KIND PersistentVolumeClaim
NAME insights-looker-lookerdir-pvc
NAMESPACE uipath
CREATED_AT 03/09/2023 16:21:05
STATUS OutOfSync
HEALTH Healthy
When trying to sync the Insights app in argocd:
SyncError
Failed sync attempt to 2022.10.1: one or more objects failed to apply, reason: PersistentVolumeClaim "insights-looker-lookerdir-pvc" is invalid: spec.resources.requests.storage: Forbidden: field can not be less than previous value (retried 4 times).
Resolution:
# Create a backup of existing argocd-cm
kubectl -n argocd get cm argocd-cm -oyaml > argocd-cm-backup.yaml
# Edit current argocd-cm configmap and search for this field resource.exclusions
kubectl edit cm argocd-cm -n argocd
# Append pvc resource i.e. to ignore any diff for pvc Insights-looker-datadir-pvc
resource.exclusions: | -------- - apiGroups: - "" kinds: - "PersistentVolumeClaim" clusters: - "*" names: - insights-looker-datadir-pvc
# Fetch argocd password and login. Replace installer-dir with absolute path
# Replace argocd-host with the alm fqdn like alm.
argocd_password=$(kubectl get secrets/"argocd-admin-password" -n "argocd" --template \{{.data.password\}\} | base64 -d)
/bin/argocd login ":443" --grpc-web --grpc-web-root-path "/" --username admin --password "${argocd_password}" --insecure
# Disable self heal operator
kubectl patch application "uipath" -n argocd --type=merge -p '{"spec" : {"syncPolicy" : {"automated" : {"selfHeal": false }}}}'
kubectl patch application "insights" -n argocd --type=merge -p '{"spec" : {"syncPolicy" : {"automated" : {"selfHeal": false }}}}'
# Scale down Insights looker deployment
kubectl -n uipath scale deploy insights-insightslooker --replicas=0
# Replace the 12Gi with actual pvc size to want post resize
echo 12Gi | numfmt --from=auto
# -> Replace this value with the actual output of previous step
kubectl -n uipath patch pvc "insights-looker-datadir-pvc" -p "{\"spec\": {\"resources\": {\"requests\": {\"storage\": \"\" }}}}"
# Enable self heal operator
kubectl patch application "insights" -n argocd --type=merge -p '{"spec" : {"syncPolicy" : {"automated" : {"selfHeal": true }}}}'
kubectl patch application "uipath" -n argocd --type=merge -p '{"spec" : {"syncPolicy" : {"automated" : {"selfHeal": true }}}}'