bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
9.07k stars 9.24k forks source link

[bitnami/mariadb] Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock #2299

Closed papanito closed 4 years ago

papanito commented 4 years ago

Describe the bug

I try to deploy nexcloud with mariadb but this fails with

10m         Warning   Unhealthy                pod/nextcloud-mariadb-master-0                          Readiness probe failed: mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mariadb/tmp/mysql.sock' exists!

This is my values.yal

nextcloud:
  host: xxxx
  username: xxxx
  password: xxx
  update: 0
  datadir: /var/www/html/data
  tableprefix:
  phpConfigs: {}
  defaultConfigs:
    .htaccess: true
    redis.config.php: true
    apache-pretty-urls.config.php: true
    apcu.config.php: true
    apps.config.php: true
    autoconfig.php: true
    smtp.config.php: true
  configs: {}

nginx:
  enabled: true
  image:
    repository: nginx
    tag: alpine
    pullPolicy: IfNotPresent
  config:
    default: true
  resources: {}

internalDatabase:
  enabled: false
  name: nextcloud

externalDatabase:
  enabled: false

mariadb:
  enabled: true
  volumePermissions:
    enabled: true
  securityContext:
    fsGroup: 82
    runAsUser: 33
  db:
    name: nextcloud
    user: nextcloud
    password: xxxx
  persistence:
    enabled: false
    accessMode: ReadWriteMany
    size: 8Gi
  master:
    persistence:
      accessModes: 
        - ReadWriteMany
  slave:
    persistence:
      accessModes:
        - ReadWriteMany
redis:
  enabled: false
  usePassword: false
cronjob:
  enabled: false

service:
  type: ClusterIP
  port: 8080
  loadBalancerIP: nil

persistence:
  enabled: true
  annotations: {}
  storageClass: "kadalu.replica3"
  accessMode: ReadWriteMany
  size: 500Gi

Version of Helm and Kubernetes:

helm version
version.BuildInfo{Version:"v3.0.3", GitCommit:"ac925eb7279f4a6955df663a0128044a8a6b7593", GitTreeState:"clean", GoVersion:"go1.13.6"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:13:49Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}

Which chart:

stable/nextcloud

What happened:

pod/nextcloud-mariadb-master-0 logs

10m         Warning   Unhealthy                pod/nextcloud-mariadb-master-0                          Readiness probe failed: mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mariadb/tmp/mysql.sock' exists!

What you expected to happen:

No error

How to reproduce it (as minimally and precisely as possible):

  1. Checkout github.com:helm/charts.git
  2. Go to stable
  3. Update requirements.yaml as follows

    dependencies:
    - name: mariadb
      version: ~7.1.0
      repository: https://charts.bitnami.com/bitnami/
      condition: mariadb.enabled
    - name: redis
      version: ~10.0.1
      repository: https://kubernetes-charts.storage.googleapis.com/
      condition: redis.enabled
  4. Run helm dependency update
  5. Run helm install nextcloud stable/nextcloud --namespace nextcloud -f nextcloud.values.yml

Anything else we need to know:

Related issue https://github.com/helm/charts/issues/20645

theAkito commented 4 years ago

https://github.com/bitnami/charts/issues/2181

marcosbc commented 4 years ago

Thanks @theAkito! For now I'm closing this as duplicate, let's continue in #2181.

marcosbc commented 4 years ago

Sorry, I just noticed that in #2181 there were changes to the MariaDB chart, which does not seem to be the case here. I'll take a look and see what could be happening.

theAkito commented 4 years ago

@marcosbc

I know you cannot rule out some introduced bugs due to the changes, but still I wanted to state for the record: All the modifications made were additive. I did not change anything about the Chart's default behaviour. I just added features to it. So the default behaviour is still present in my issue...

marcosbc commented 4 years ago

@papanito We could get MariaDB to work with the changes below to your configuration:

Let us know if that works for you.

papanito commented 4 years ago

@marcosbc thanks, that did the trick. I was confused with the runAsUser and fsGroup thought it should be the same as for the nextcloud :-/

theAkito commented 4 years ago

Well, I am using this trick since the start (as it is the default), yet didn't solve anything. Seems like my case is still special, after all.