pg-ha部署后,如果需要升级,或者更新某些字段,需要注意pvc里的数据的保存

如果没有配置需要的三种密码,再做upgrade时候,会给出提示。

helm -nbanya upgrade pg . --wait --timeout=3600s
Error: UPGRADE FAILED: execution error at (postgresql-ha/templates/NOTES.txt:107:4): 
PASSWORDS ERROR: You must provide your current passwords when upgrading the release.
                 Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims.
                 Further information can be obtained at <https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases>

    'postgresql.password' must not be empty, please add '--set postgresql.password=$PASSWORD' to the command. To get the current value:

        export PASSWORD=$(kubectl get secret --namespace "banya" pg-postgresql-ha-postgresql -o jsonpath="{.data.password}" | base64 -d)

    'postgresql.repmgrPassword' must not be empty, please add '--set postgresql.repmgrPassword=$REPMGR_PASSWORD' to the command. To get the current value:

        export REPMGR_PASSWORD=$(kubectl get secret --namespace "banya" pg-postgresql-ha-postgresql -o jsonpath="{.data.repmgr-password}" | base64 -d)

    'pgpool.adminPassword' must not be empty, please add '--set pgpool.adminPassword=$ADMIN_PASSWORD' to the command. To get the current value:

        export ADMIN_PASSWORD=$(kubectl get secret --namespace "banya" pg-postgresql-ha-pgpool -o jsonpath="{.data.admin-password}" | base64 -d)

按照提示,增加密码就可以。

export PASSWORD=$(kubectl get secret --namespace "banya" pg-postgresql-ha-postgresql -o jsonpath="{.data.password}" | base64 -d)
export REPMGR_PASSWORD=$(kubectl get secret --namespace "banya" pg-postgresql-ha-postgresql -o jsonpath="{.data.repmgr-password}" | base64 -d)
export ADMIN_PASSWORD=$(kubectl get secret --namespace "banya" pg-postgresql-ha-pgpool -o jsonpath="{.data.admin-password}" | base64 -d)

helm -nns upgrade pg . --wait --timeout=3600s --set postgresql.password=$PASSWORD --set postgresql.repmgrPassword=$REPMGR_PASSWORD --set pgpool.adminPassword=$ADMIN_PASSWORD