I am deploying spring boot application on k8s cluster .
For that I am generated dynamic postgres credential from vault . With single replica the application is successfully deployed , but when I scale the replica to 2 , the second replica will execute with different dynamic postgres credential from vault and it tries to execute the liquibase again on the same DB, which is causing the ‘relation “databasechangeloglock” already exists’ in the replica pod .
Why is the second user executing liquibase again ?
let first user - v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640
let second user - v-kubernet-app-rol-YPJkSfOSZCinYQWxwv8h-1657284714
in psql
\z
Schema | Name | Type | Access privileges | Column privileges | Policies
--------+-----------------------------------------------------------------+----------+--------------------------------------------------------------------------------------------------------------------------+-------------------+----------
public | databasechangelog | table | "java.jks-1657283026127"=arwd/"v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640"+| |
| | | "v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640"=arwdDxt/"v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640" | |
public | databasechangeloglock | table | "java.jks-1657283026127"=arwd/"v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640"+| |
| | | "v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640"=arwdDxt/"v-kubernet-app-rol-vHwFwAzwPnUKotP9aeSP-1657284640" | |
**error Caused by: org.postgresql.util.PSQLException: ERROR: relation "databasechangeloglock" already exists**