Asking for help? Comment out what you need so we can get more information to help you!
Cluster information:
Kubernetes version: 1.23
Cloud being used: AWS EKS
Installation method: aws managed, built with terraform
Host OS:
CNI and version:
CRI and version:
I have backend pod and mysql statefulset, which I built according to this docker-compose.
version: '3.1'
services:
swagger-ui:
image: swaggerapi/swagger-ui
container_name: swagger_ui_container
ports:
- "81:8080"
volumes:
- ./smth-rest/src/main/resources:/usr/share/nginx/html/doc
environment:
API_URL: https://$ENV/config/doc/openapi.yaml
be:
container_name: examo-be
image: $AWS_ECR/$BITBUCKET_REPO_FULL_NAME:$BITBUCKET_BRANCH-latest
ports:
- 8080:3333
- 3334:3334
depends_on:
- db
db:
container_name: smth-db
image: mysql:latest
restart: always
ports:
- 3308:3306
environment:
MYSQL_ROOT_PASSWORD: [somepassword]
MYSQL_DATABASE: [db]
MYSQL_USER: [user]
MYSQL_PASSWORD: [user]
volumes:
- smth-db-volume:/var/lib/mysql
volumes:
smth-db-volume:
When backend is starting migrations, it is error
PS C:\Users\user\Downloads> kubectl logs examo-7cb4c7f5c8-kjdkj -n dev
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
[INFO ] 2023-03-21 07:41:32.104 [vert.x-eventloop-thread-1] OpenApiRouterBuilder - OpenApi has been loaded
[INFO ] 2023-03-21 07:41:32.145 [vert.x-eventloop-thread-1] MainServerVerticle - Started REST api server on port: 3333
[INFO ] 2023-03-21 07:41:32.152 [vert.x-eventloop-thread-0] WebsocketServerVerticle - Started server for websockets on port: 3334
[INFO ] 2023-03-21 07:41:32.174 [vert.x-eventloop-thread-1] MainServerVerticle - All verticles have been deployed
[ERROR] 2023-03-21 07:41:32.357 [vert.x-eventloop-thread-1] FlywayRunner - org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database (jdbc:mysql://db:3306/examodb?allowPublicKeyRetrieval=true&useSSL=false) for user 'postgresql': Access denied for user 'postgresql'@'10.0.4.201' (using password: YES)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 28000
Error Code : 1045
Message : Access denied for user 'postgresql'@'10.0.4.201' (using password: YES)
[ERROR] 2023-03-21 07:41:32.364 [vert.x-eventloop-thread-1] ContextImpl - Unhandled exception
org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database (jdbc:mysql://db:3306/examodb?allowPublicKeyRetrieval=true&useSSL=false) for user 'postgresql': Access denied for user 'postgresql'@'10.0.4.201' (using password: YES)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 28000
Error Code : 1045
Message : Access denied for user 'postgresql'@'10.0.4.201' (using password: YES)
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:67) ~[app.jar:?]
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:74) ~[app.jar:?]
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:136) ~[app.jar:?]
at org.flywaydb.core.Flyway.repair(Flyway.java:330) ~[app.jar:?]
at examo.db.migration.FlywayRunner.migrate(FlywayRunner.java:19) ~[app.jar:?]
at examo.rest.server.MainServerVerticle.lambda$start$13(MainServerVerticle.java:116) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl$1.onSuccess(FutureImpl.java:91) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262) ~[app.jar:?]
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211) ~[app.jar:?]
at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62) ~[app.jar:?]
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211) ~[app.jar:?]
at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40) ~[app.jar:?]
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54) ~[app.jar:?]
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:81) ~[app.jar:?]
at io.vertx.core.impl.ContextImpl.execute(ContextImpl.java:260) ~[app.jar:?]
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:22) ~[app.jar:?]
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211) ~[app.jar:?]
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23) ~[app.jar:?]
at io.vertx.core.Promise.complete(Promise.java:66) ~[app.jar:?]
at io.vertx.core.impl.DeploymentManager.lambda$null$4(DeploymentManager.java:210) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141) ~[app.jar:?]
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:196) ~[app.jar:?]
at io.vertx.core.impl.future.PromiseImpl.addListener(PromiseImpl.java:23) ~[app.jar:?]
at io.vertx.core.impl.future.FutureImpl.onComplete(FutureImpl.java:164) ~[app.jar:?]
at io.vertx.core.impl.future.PromiseImpl.onComplete(PromiseImpl.java:23) ~[app.jar:?]
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$5(DeploymentManager.java:197) ~[app.jar:?]
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100) ~[app.jar:?]
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63) ~[app.jar:?]
at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38) ~[app.jar:?]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[app.jar:?]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) ~[app.jar:?]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) ~[app.jar:?]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[app.jar:?]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[app.jar:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[app.jar:?]
at java.lang.Thread.run(Thread.java:832) ~[?:?]
Caused by: java.sql.SQLException: Access denied for user 'postgresql'@'10.0.4.201' (using password: YES)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[app.jar:?]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[app.jar:?]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[app.jar:?]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:832) ~[app.jar:?]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[app.jar:?]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) ~[app.jar:?]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207) ~[app.jar:?]
at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:259) ~[app.jar:?]
at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnection(DriverDataSource.java:223) ~[app.jar:?]
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:52) ~[app.jar:?]
... 39 more
Caused by: java.sql.SQLException: Access denied for user ‘postgresql’@‘10.0.4.201’ (using password: YES) this is the error. When I check the database, the user postgresql doesn’t exist, only root exist. In the secret database name, user, password is correct.