Grafana Postgres and Docker Database issues

  • What Grafana version and what operating system are you using?

I have a kubernetes deployment based on: grafana/grafana:9.0.2-ubuntu

  • What are you trying to achieve?

Issues doing a new installation using a postgres database.

  • How are you trying to achieve it?

I have defined the following variables:

GF_DATABASE_TYPE=postgres
GF_DATABASE_NAME=dashboard
GF_DATABASE_PASSWORD=FD38,eUGUhVX|iJ|0E<{cEIO ##staging so whatever you get an idea of the character set
GF_DATABASE_HOST=dashboard-v5-2-0-ha.postgres-operator.svc.cluster.local
GF_DATABASE_USER=dbadmin

  • What happened?

Fails to start with the following error:

INFO [10-04|17:08:01] Path Plugins                             logger=settings path=/var/lib/grafana/plugins
INFO [10-04|17:08:01] Path Provisioning                        logger=settings path=/etc/grafana/provisioning
INFO [10-04|17:08:01] App mode production                      logger=settings
INFO [10-04|17:08:01] Connecting to DB                         logger=sqlstore dbtype=postgres
ERROR[10-04|17:08:01] alert migration failure: could not get migration log logger=migrator error="failed to check table existence: pq: no pg_hba.conf entry for host \"10.116.0.26\", user \"dbadmin\", database \"dashboard\", no encryption"

note, I additionally install a postgres-client. The following works without any problems:

psql -U $GF_DATABASE_USER -h $GF_DATABASE_HOST -d $GF_DATABASE_NAME

  • What did you expect to happen?

A valid DB connection and a fresh grafana installation to succeed.

  • Can you copy/paste the configuration(s) that you are having problems with?
GF_AUTH_GOOGLE_ALLOW_SIGN_UP=true
GF_AUTH_GOOGLE_ENABLED=true
GF_AUTH_GOOGLE_AUTH_URL=https://accounts.google.com/o/oauth2/auth
GF_AUTH_GOOGLE_SCOPES=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
GF_AUTH_OAUTH_AUTO_LOGIN=true
GF_AUTH_GOOGLE_CLIENT_ID=****
GF_LOG_CONSOLE_LEVEL=debug
GF_DATABASE_TYPE=postgres
GF_LOG_LEVEL=debug
GF_USERS_DEFAULT_THEME=light
GF_PATHS_HOME=/usr/share/grafana
GF_AUTH_GOOGLE_TOKEN_URL=https://accounts.google.com/o/oauth2/token
GF_USERS_AUTO_ASSIGN_ORG_ROLE=Editor
GF_SERVER_SERVE_FROM_SUB_PATH=false
GF_PANELS_DISABLE_SANITIZE_HTML=true
GF_AUTH_GOOGLE_ALLOWED_DOMAINS=es.net lbl.gov
GF_PATHS_PROVISIONING=/etc/grafana/provisioning
GF_DATABASE_NAME=dashboard
GF_DATABASE_PASSWORD=FD38,eUGUhVX|iJ|0E<{cEIO
GF_AUTH_GOOGLE_CLIENT_SECRET=****
GF_PATHS_DATA=/var/lib/grafana
GF_DATABASE_HOST=dashboard-v5-2-0-ha.postgres-operator.svc.cluster.local
GF_INSTALL_PLUGINS=grafana-worldmap-panel,agenty-flowcharting-panel,grafana-googlesheets-datasource,grafana-polystat-panel,redis-datasource,vonage-status-panel,flant-statusmap-panel,gretamosa-topology-panel,gowee-traceroutemap-panel,pr0ps-trackmap-panel,aceiot-svg-panel,marcuscalidus-svg-panel,marcusolsson-hourly-heatmap-panel,netsage-sankey-panel,marcusolsson-treemap-panel,netsage-slopegraph-panel
GF_PATHS_LOGS=/var/log/grafana
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=netsage-bumpchart-panel,esnet-matrix-panel,esnet-chord-panel,esnet-networkmap-panel,netsage-migrationmap
GF_SERVER_ROOT_URL=https://%(domain)s/
GF_DATABASE_USER=dbadmin
GF_SERVER_DOMAIN=***
GF_PATHS_PLUGINS=/var/lib/grafana/plugins
GF_PATHS_CONFIG=/etc/grafana/grafana.ini
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

UI won’t load.

  • Final Notes

I tried setting GF_DATABASE_HOST to include the port number aka host:5432 and exclude it and it has the same behavior. Is there some special flag that needs to be passed in order to bootstrap the database ? Maybe something changed since the last time I went through this procedure with a fresh install.

Any help would be appreciated, but seeing as a valid DB connection can be established from the container to the database the issue shouldn’t be anything with kubernetes or services and something with the grafana configuration.

What am I missing?

bump. Any ideas? Or how would I get more verbose logging in the docker containers?