bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.85k stars 9.14k forks source link

helm install my-release bitnami/mysql causes Pod in CrashLoopBackOff #4134

Closed siegfried01 closed 3 years ago

siegfried01 commented 3 years ago

I'm using the command "helm install my-release bitnami/mysql" as decribed here: https://bitnami.com/stack/mysql/helm

Describe the bug MySQL pod is in CrashLoopBackOff mode (as seen in "kubectl get pods")

To Reproduce Steps to reproduce the behavior:

  1. On Windows 10 running Docker For Desktop Kubernetes
  2. install with commands: "helm repo add bitnami https://charts.bitnami.com/bitnami helm install my-release bitnami/mysql"
  3. kubectl get all -A
  4. use kubectl to delete all mysql svc, pvc, deployments...
  5. helm delete mysql
  6. helm install my-release bitnami/mysql
  7. wait approx 10 minutes, maybe less
  8. kubectl get pods
  9. kubectl describe my-release-mysql-master-0

Expected behavior kubectl get pods should report that my-release-mysql-master-0 is running

Version of Helm and Kubernetes:

version.BuildInfo{Version:"v3.3.0-rc.1", GitCommit:"5c2dfaad847df2ac8f289d278186d048f446c70c", GitTreeState:"dirty", GoVersion:"go1.14.4"}
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8", GitCommit:"9f2892aab98fe339f3bd70e3c470144299398ace", GitTreeState:"clean", BuildDate:"2020-08-13T16:12:48Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8", GitCommit:"9f2892aab98fe339f3bd70e3c470144299398ace", GitTreeState:"clean", BuildDate:"2020-08-13T16:04:18Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

Additional context: Output from kubectl describe my-release-mysql-master-0

Name:         my-release-mysql-master-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Tue, 27 Oct 2020 19:27:48 -0700
Labels:       app=mysql
              chart=mysql-6.14.11
              component=master
              controller-revision-hash=my-release-mysql-master-6dbf6fc558
              heritage=Helm
              release=my-release
              statefulset.kubernetes.io/pod-name=my-release-mysql-master-0
Annotations:  <none>
Status:       Running
IP:           10.1.0.39
IPs:
  IP:           10.1.0.39
Controlled By:  StatefulSet/my-release-mysql-master
Containers:
  mysql:
    Container ID:   docker://bc847a04c85eaf4b778315ae694101527339c66b3519fcfc7259aa064adfa131
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r0
    Image ID:       docker-pullable://bitnami/mysql@sha256:61a3cc77e41758e5f13bccafc7513101d3ded4848652df68d9164aafcf4d9258
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Tue, 27 Oct 2020 19:57:48 -0700
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Tue, 27 Oct 2020 19:49:45 -0700
      Finished:     Tue, 27 Oct 2020 19:52:38 -0700
    Ready:          False
    Restart Count:  8
    Liveness:       exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:               false
      MYSQL_ROOT_PASSWORD:         <set to the key 'mysql-root-password' in secret 'my-release-mysql'>  Optional: false
      MYSQL_DATABASE:              my_database
      MYSQL_REPLICATION_MODE:      master
      MYSQL_REPLICATION_USER:      replicator
      MYSQL_REPLICATION_PASSWORD:  <set to the key 'mysql-replication-password' in secret 'my-release-mysql'>  Optional: false
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-release-mysql-token-lx2zn (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-my-release-mysql-master-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-release-mysql-master
    Optional:  false
  my-release-mysql-token-lx2zn:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-release-mysql-token-lx2zn
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                From                     Message
  ----     ------            ----               ----                     -------
  Warning  FailedScheduling  <unknown>          default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>          default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Normal   Scheduled         <unknown>          default-scheduler        Successfully assigned default/my-release-mysql-master-0 to docker-desktop
  Normal   Started           29m                kubelet, docker-desktop  Started container mysql
  Warning  Unhealthy         27m (x3 over 27m)  kubelet, docker-desktop  Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Normal   Killing    27m                   kubelet, docker-desktop  Container mysql failed liveness probe, will be restarted
  Normal   Pulled     26m (x2 over 29m)     kubelet, docker-desktop  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r0" already present on machine
  Warning  Unhealthy  26m                   kubelet, docker-desktop  Readiness probe errored: rpc error: code = Unknown desc = container not running (d2a099eebc034a9c8d3d494026347d3245729ac76ade70c02e6c4ffd2019af24)
  Normal   Created    26m (x2 over 29m)     kubelet, docker-desktop  Created container mysql
  Warning  Unhealthy  9m45s (x97 over 29m)  kubelet, docker-desktop  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Warning  BackOff  4m36s (x6 over 5m22s)  kubelet, docker-desktop  Back-off restarting failed container
rafariossaa commented 3 years ago

Hi, I have notice in your steps that you delete the resources with kubectl and then run helm delete, it should be the other way around. First run helm delete mysql, it will delete all the resources created but the PVC, then you can delete the PVC with kubectl. Does this happens only when deploying it again ? Could you provide also the logs ?

siegfried01 commented 3 years ago

I did it in that order because I am new to helm and did not know about the "helm delete" command and executing the "helm delete" command allowed me to run the helm install command again (previously I was getting some error because apparently I had failed to delete everything related to the bitnami mysql).

What is the preferred way of starting over with bitnami mysql? Is just doing helm delete sufficient to remove everything before issuing the helm install command again? Or do I still have to use kubectl to delete stuff like pvcs? And if so, is the order important?

Is it possible the helm delete did not work right because I attempted to delete the pv, pvc, svcs, pods and deployments manually first? If so, how do I recover?

Now you also asked what happened the first time.... Hmm.... See https://stackoverflow.com/questions/64472740/connecting-to-mysql-5-6-inside-docker-for-desktop-kubernetes-error-1130-hy000?noredirect=1#comment114164526_64472740.... I believe the bitnami pod logs were good (no errors like they are most recently) but I did not think to describe the pods the first time I used bitnami/mysql. However, I don't remember seeing the crashbackoff state of the pods. But as you can see in that link, it was still not working... So I decided to start over.

This brings up another question: is there any reason to believe that the the reason I could not connect to the bitnami/mysql the first time was because the binding address was not 0.0.0.0?

So what logs do you want? Do you want kubernetes pod logs? Or perhaps stdout from my interactive kubectl session?

Here is the log from the MySQL my-release-mysql-master-0 pod. Previously I posted the results of the "describe" command because that contained error messages and I don't see any in the pod logs:

mysql 15:14:31.07 
mysql 15:14:31.08 Welcome to the Bitnami mysql container
mysql 15:14:31.08 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 15:14:31.08 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 15:14:31.08 
mysql 15:14:31.08 INFO  ==> ** Starting MySQL setup **
mysql 15:14:31.10 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 15:14:31.10 INFO  ==> Initializing mysql database
mysql 15:14:31.13 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 15:14:31.13 INFO  ==> Using persisted data
mysql 15:14:31.16 INFO  ==> Running mysql_upgrade
mysql 15:14:31.17 INFO  ==> Starting mysql in background

If you want the stdout from my kubectl session, please indicate if I need to do the "helm delete" command and start over.

I tried to get the logs from the my-release-mysql-master-0 service but apparently svcs don't have logs like pods....

Wed Oct 28 2020 Evening Update:

Seems that kubectl get pods will eventually display "running" again but the kubectl describe pod my-release-mysql-master-0`` does not change and thekubectl log my-release-mysql-master-0``` does not change either. So perhaps I'm getting consistent results with the first deployment after all because I may not have waited long enough the first time.

Thanks for the prompt response!

siegfried

rafariossaa commented 3 years ago

Hi, helm delete will delete all the resources (pods, svc, deployments, jobs, etc.) created by helm install, but PVC, because there is where your data are and maybe you want to preserve it or reuse it in an new helm install. So, to delete the deployment, first run helm delete and wait until all the resources are deleted to run again helm install using the same name. If you will be using a different name you don't need to wait. If you run helm install with the same name, without removing the PVCs with kubectl delete pvc ..., the container will use the existent data. If you want clean it all, you need to run kubeclt delete pvc ... after the helm delete. If you don't run helm delete and for example run kubectl delete pod ... kubernetes will start a new pod to meet the number of needed pods. I would suggest you to take a tutorial on kubernetes and helm to get this concepts and procedures. The log I would need if the pod's one. As you can see in the log, the pod is reusing the data ==> Using persisted data, this can raised some issues if you don't set the passwords manually. In the first install helm will generate random passwords and when you start it again using the previous data, helm will generate a new random password that will not match the previous one. So, I would suggest you to clean it all (helm delete + kubectl delete pvc) and start again. If you will be reusing the PVCs, take note of the password and in the second helm install pass it with --set root.password=XXXX where XXXX is the obtained password.

siegfried01 commented 3 years ago

OK, thanks! Yes -- deleting the pvcs makes sense.... I ran in to that same problem with the bitnami/postgresql...

I have done the helm delete and I have deleted the pvc and confirmed that the corresponding pv were deleted too.

The pod log is nearly identical... The k describe pod my-release-mysql-master-0 seems to vary only in the times..

Just in case I missed something, here is the latest describe and log for the master:


Name:         my-release-mysql-master-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Thu, 29 Oct 2020 09:59:45 -0700
Labels:       app=mysql
              chart=mysql-6.14.11
              component=master
              controller-revision-hash=my-release-mysql-master-6dbf6fc558
              heritage=Helm
              release=my-release
              statefulset.kubernetes.io/pod-name=my-release-mysql-master-0
Annotations:  <none>
Status:       Running
IP:           10.1.0.45
IPs:
  IP:           10.1.0.45
Controlled By:  StatefulSet/my-release-mysql-master
Containers:
  mysql:
    Container ID:   docker://6cf7a3e3c45a50caddf8acffe9438c0c47c714bab8d15b059857bcb47a9f8676
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r0
    Image ID:       docker-pullable://bitnami/mysql@sha256:61a3cc77e41758e5f13bccafc7513101d3ded4848652df68d9164aafcf4d9258
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Thu, 29 Oct 2020 10:11:55 -0700
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Thu, 29 Oct 2020 10:08:54 -0700
      Finished:     Thu, 29 Oct 2020 10:11:49 -0700
    Ready:          False
    Restart Count:  4
    Liveness:       exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:               false
      MYSQL_ROOT_PASSWORD:         <set to the key 'mysql-root-password' in secret 'my-release-mysql'>  Optional: false
      MYSQL_DATABASE:              my_database
      MYSQL_REPLICATION_MODE:      master
      MYSQL_REPLICATION_USER:      replicator
      MYSQL_REPLICATION_PASSWORD:  <set to the key 'mysql-replication-password' in secret 'my-release-mysql'>  Optional: false
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-release-mysql-token-rkprq (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-my-release-mysql-master-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-release-mysql-master
    Optional:  false
  my-release-mysql-token-rkprq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-release-mysql-token-rkprq
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                  From                     Message
  ----     ------            ----                 ----                     -------
  Warning  FailedScheduling  <unknown>            default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>            default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Normal   Scheduled         <unknown>            default-scheduler        Successfully assigned default/my-release-mysql-master-0 to docker-desktop
  Normal   Killing           11m                  kubelet, docker-desktop  Container mysql failed liveness probe, will be restarted
  Warning  Unhealthy         10m                  kubelet, docker-desktop  Readiness probe failed: OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "process_linux.go:101: executing setns process caused \"exit status 1\"": unknown
  Normal   Pulled            10m (x2 over 13m)    kubelet, docker-desktop  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r0" already present on machine
  Normal   Created           10m (x2 over 13m)    kubelet, docker-desktop  Created container mysql
  Normal   Started           10m (x2 over 13m)    kubelet, docker-desktop  Started container mysql
  Warning  Unhealthy         8m31s (x4 over 11m)  kubelet, docker-desktop  Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Warning  Unhealthy  3m30s (x48 over 13m)  kubelet, docker-desktop  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!

Here is the lastest log for the master:

mysql 17:14:55.21 
mysql 17:14:55.21 Welcome to the Bitnami mysql container
mysql 17:14:55.21 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 17:14:55.21 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 17:14:55.22 
mysql 17:14:55.22 INFO  ==> ** Starting MySQL setup **
mysql 17:14:55.23 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 17:14:55.24 INFO  ==> Initializing mysql database
mysql 17:14:55.26 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 17:14:55.26 INFO  ==> Using persisted data
mysql 17:14:55.29 INFO  ==> Running mysql_upgrade
mysql 17:14:55.30 INFO  ==> Starting mysql in background
rafariossaa commented 3 years ago

Hi, Can you enable debugging and provide the whole log ?

siegfried01 commented 3 years ago

I assume you want me to helm install my-release --set image.debug=true bitnami/mysql?

OK, I deleted the mysql pvcs and confirmed that this deleted the pvs and then issued the command

helm install my-release --set image.debug=true bitnami/mysql

Thanks Siegfried

Here is the logs. What does Bind-address: '::' port: 33060, mean?

I'm getting inconsistent results from the logs command. Here is the first log:

mysql 19:35:43.51 Welcome to the Bitnami mysql container
mysql 19:35:43.51 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 19:35:43.51 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 19:35:43.52 
mysql 19:35:43.52 INFO  ==> ** Starting MySQL setup **
mysql 19:35:43.53 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 19:35:43.54 INFO  ==> Initializing mysql database
mysql 19:35:43.54 DEBUG ==> Ensuring expected directories/files exist
mysql 19:35:43.56 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 19:35:43.56 INFO  ==> Using persisted data
mysql 19:35:43.59 INFO  ==> Running mysql_upgrade
mysql 19:35:43.60 INFO  ==> Starting mysql in background
2020-10-30T19:35:43.855124Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 53
2020-10-30T19:35:43.857468Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-10-30T19:35:43.857479Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-10-30T19:35:43.932810Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-10-30T19:36:37.906734Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-10-30T19:36:39.641431Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-10-30T19:36:39.683351Z 4 [System] [MY-013381] [Server] Server upgrade from '80022' to '80022' started.

Here is the log file again several hours later and it includes an 'ALTER TABLE` error! I am sure I deleted that pv/pvc before reinstalling via helm! Could this be a bug?

$ k logs my-release-mysql-master-0
mysql 21:59:50.37 
mysql 21:59:50.37 Welcome to the Bitnami mysql container
mysql 21:59:50.38 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 21:59:50.39 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 21:59:50.39 
mysql 21:59:50.40 INFO  ==> ** Starting MySQL setup **
mysql 21:59:50.59 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 21:59:50.60 INFO  ==> Initializing mysql database
mysql 21:59:50.61 DEBUG ==> Ensuring expected directories/files exist
mysql 21:59:50.68 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 21:59:50.68 INFO  ==> Using persisted data
mysql 21:59:50.76 INFO  ==> Running mysql_upgrade
mysql 21:59:50.80 INFO  ==> Starting mysql in background
2020-10-30T21:59:51.375292Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 52
2020-10-30T21:59:51.379007Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-10-30T21:59:51.379028Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-10-30T21:59:51.438845Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-10-30T21:59:58.929559Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-10-30T22:00:01.765813Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-10-30T22:00:01.867003Z 4 [System] [MY-013381] [Server] Server upgrade from '80022' to '80022' started.
***2020-10-30T22:00:59.735682Z 4 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement 'ALTER TABLE general_log   MODIFY event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),   MODIFY user_host MEDIUMTEXT NOT NULL,   MODIFY thread_id INTEGER NOT NULL,   MODIFY server_id INTEGER UNSIGNED NOT NULL,   MODIFY command_type VARCHAR(64) NOT NULL,   MODIFY argument MEDIUMBLOB NOT NULL; ' failed with error code = 1050, error message = 'Table '#sql2-34-4' already exists'.***
2020-10-30T22:00:59.925312Z 0 [ERROR] [MY-013380] [Server] Failed to upgrade server.
2020-10-30T22:00:59.926145Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-10-30T22:01:40.405948Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.

Here is the describe pod results:



Name:         my-release-mysql-master-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Fri, 30 Oct 2020 12:14:32 -0700
Labels:       app=mysql
              chart=mysql-6.14.11
              component=master
              controller-revision-hash=my-release-mysql-master-58b88f7575
              heritage=Helm
              release=my-release
              statefulset.kubernetes.io/pod-name=my-release-mysql-master-0
Annotations:  <none>
Status:       Running
IP:           10.1.0.54
IPs:
  IP:           10.1.0.54
Controlled By:  StatefulSet/my-release-mysql-master
Containers:
  mysql:
    Container ID:   docker://d17d1cc6f3c17ad2f58c01bccd24d3afbba8c5cf325c9f9beb10b3f06cf77190
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r0
    Image ID:       docker-pullable://bitnami/mysql@sha256:61a3cc77e41758e5f13bccafc7513101d3ded4848652df68d9164aafcf4d9258
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Fri, 30 Oct 2020 12:35:43 -0700
      Finished:     Fri, 30 Oct 2020 12:38:39 -0700
    Ready:          False
    Restart Count:  7
    Liveness:       exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:               true
      MYSQL_ROOT_PASSWORD:         <set to the key 'mysql-root-password' in secret 'my-release-mysql'>  Optional: false
      MYSQL_DATABASE:              my_database
      MYSQL_REPLICATION_MODE:      master
      MYSQL_REPLICATION_USER:      replicator
      MYSQL_REPLICATION_PASSWORD:  <set to the key 'mysql-replication-password' in secret 'my-release-mysql'>  Optional: false
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-release-mysql-token-tqf6p (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-my-release-mysql-master-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-release-mysql-master
    Optional:  false
  my-release-mysql-token-tqf6p:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-release-mysql-token-tqf6p
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                From                     Message
  ----     ------            ----               ----                     -------
  Warning  FailedScheduling  <unknown>          default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>          default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Normal   Scheduled         <unknown>          default-scheduler        Successfully assigned default/my-release-mysql-master-0 to docker-desktop
  Warning  Unhealthy         26m (x3 over 26m)  kubelet, docker-desktop  Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Normal   Killing    26m                   kubelet, docker-desktop  Container mysql failed liveness probe, will be restarted
  Normal   Pulled     25m (x2 over 28m)     kubelet, docker-desktop  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r0" already present on machine
  Normal   Created    25m (x2 over 28m)     kubelet, docker-desktop  Created container mysql
  Warning  Unhealthy  25m                   kubelet, docker-desktop  Readiness probe errored: rpc error: code = Unknown desc = container not running (222729f590074dc4cfdd4fad3bc1837cc06cb4b1c49cc7f2834e1d07de9f4cb3)
  Normal   Started    25m (x2 over 28m)     kubelet, docker-desktop  Started container mysql
  Warning  Unhealthy  8m38s (x98 over 27m)  kubelet, docker-desktop  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Warning  BackOff  3m39s (x7 over 4m45s)  kubelet, docker-desktop  Back-off restarting failed container```
siegfried01 commented 3 years ago

Since I got to thinking that maybe my bitnami postgresql was interfering with the bitnami mysql, I helm delete pgsql and deleted the pvcs and then tried the helm install my-release --set image.debug=true bitnami/mysql again and I got another clue. Everything looks pretty much the same except for this error message in the debug logs:

mysqld: Table 'mysql.plugin' doesn't exist

What does this mean? Is it a bug?

OK, in case I missed anything, here are the debug logs and the describe again:

 logs pod/my-release-mysql-master-0

mysql 17:28:54.93 
mysql 17:28:54.93 Welcome to the Bitnami mysql container
mysql 17:28:54.94 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 17:28:54.94 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 17:28:54.94 
mysql 17:28:54.94 INFO  ==> ** Starting MySQL setup **
mysql 17:28:54.96 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 17:28:54.96 INFO  ==> Initializing mysql database
mysql 17:28:54.96 DEBUG ==> Ensuring expected directories/files exist
mysql 17:28:54.97 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 17:28:54.98 INFO  ==> Using persisted data
mysql 17:28:55.01 INFO  ==> Running mysql_upgrade
mysql 17:28:55.05 INFO  ==> Starting mysql in background
2020-11-02T17:28:55.278418Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 53
2020-11-02T17:28:55.280082Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-11-02T17:28:55.280096Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-11-02T17:28:55.617732Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-02T17:29:25.133085Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table 'mysql.plugin' doesn't exist
2020-11-02T17:29:26.260445Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2020-11-02T17:29:26.656500Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock

NAME                        READY   STATUS    RESTARTS   AGE     IP          NODE             NOMINATED NODE   READINESS GATES
my-release-mysql-master-0   0/1     Running   1          4m15s   10.1.0.74   docker-desktop   <none>           <none>
my-release-mysql-slave-0    0/1     Running   1          4m15s   10.1.0.73   docker-desktop   <none>           <none>

 describe pod/my-release-mysql-master-0

Name:         my-release-mysql-master-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Mon, 02 Nov 2020 09:25:43 -0800
Labels:       app=mysql
              chart=mysql-6.14.11
              component=master
              controller-revision-hash=my-release-mysql-master-58b88f7575
              heritage=Helm
              release=my-release
              statefulset.kubernetes.io/pod-name=my-release-mysql-master-0
Annotations:  <none>
Status:       Running
IP:           10.1.0.74
IPs:
  IP:           10.1.0.74
Controlled By:  StatefulSet/my-release-mysql-master
Containers:
  mysql:
    Container ID:   docker://2656367a3a9cf7b197c9be5509f1ff313a54377a36a0747dc4a67b6159309976
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r0
    Image ID:       docker-pullable://bitnami/mysql@sha256:61a3cc77e41758e5f13bccafc7513101d3ded4848652df68d9164aafcf4d9258
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 02 Nov 2020 09:28:54 -0800
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Mon, 02 Nov 2020 09:25:55 -0800
      Finished:     Mon, 02 Nov 2020 09:28:49 -0800
    Ready:          False
    Restart Count:  1
    Liveness:       exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:               true
      MYSQL_ROOT_PASSWORD:         <set to the key 'mysql-root-password' in secret 'my-release-mysql'>  Optional: false
      MYSQL_DATABASE:              my_database
      MYSQL_REPLICATION_MODE:      master
      MYSQL_REPLICATION_USER:      replicator
      MYSQL_REPLICATION_PASSWORD:  <set to the key 'mysql-replication-password' in secret 'my-release-mysql'>  Optional: false
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-release-mysql-token-9v6m2 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-my-release-mysql-master-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-release-mysql-master
    Optional:  false
  my-release-mysql-token-9v6m2:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-release-mysql-token-9v6m2
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                     From                     Message
  ----     ------            ----                    ----                     -------
  Warning  FailedScheduling  <unknown>               default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>               default-scheduler        running "VolumeBinding" filter plugin for pod "my-release-mysql-master-0": pod has unbound immediate PersistentVolumeClaims
  Normal   Scheduled         <unknown>               default-scheduler        Successfully assigned default/my-release-mysql-master-0 to docker-desktop
  Normal   Killing           2m52s                   kubelet, docker-desktop  Container mysql failed liveness probe, will be restarted
  Warning  Unhealthy         2m30s (x14 over 4m40s)  kubelet, docker-desktop  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Warning  Unhealthy  2m20s                  kubelet, docker-desktop  Readiness probe failed: OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "process_linux.go:101: executing setns process caused \"exit status 1\"": unknown
  Normal   Pulled     2m18s (x2 over 5m19s)  kubelet, docker-desktop  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r0" already present on machine
  Normal   Created    2m16s (x2 over 5m16s)  kubelet, docker-desktop  Created container mysql
  Normal   Started    2m14s (x2 over 5m14s)  kubelet, docker-desktop  Started container mysql
  Warning  Unhealthy  12s (x4 over 3m12s)    kubelet, docker-desktop  Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
rafariossaa commented 3 years ago

Hi,

I assume you want me to helm install my-release --set image.debug=true bitnami/mysql?

Yes that's it.

Here is the logs. What does Bind-address: '::' port: 33060, mean?

That is localhost in IPv6 https://en.wikipedia.org/wiki/IPv6_address#Representation

Since I got to thinking that maybe my bitnami postgresql was interfering with the bitnami mysql ....

As long as the resources have different names it should not interfere.

What it is weird to me is that you have always this in the log:

�[38;5;6mmysql �[38;5;5m17:28:54.98 �[0m�[38;5;2mINFO �[0m ==> Using persisted data

That means it is using previous data, this could be because the PVC is being reused or because the pod got restarted, so maybe there is some previous information on the log.

In any case, you are running kubernetes on windows and docker is already known to have issues in windows, I guess kubernetes too. Is is possible to you to try the charts in other platform ?.

siegfried01 commented 3 years ago

I tried it (bitnami/mysql) yesterday for the first on Azure Kubernetes and I was able to confirm the logs and description where healthy and

kubectl run mysql-release-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mysql:8.0.22-debian-10-r0 --namespace default --command -- bash

and create a database and a user. This was encouraging and things seemed fine when using this client...

The database and user was for use with a little C# tutorial console program. Unlike docker-for-desktop where I am always using the same cluster, this was a new cluster.

I tried to use the kubectl port-forwarding feature to run my tutorial app and it appeared to be working (socket connection seemed to succeed) except for the fact I was unable to grant myself sufficient priviledges to access the database via port forwarding.... Is there some security issue that I need to suppress so I can connect from outside the kubernetes cluster?

Now that I think about it, it was probably because I forgot to issue the C# EntityFramework call to create the tables... Oops...

Back to Docker for desktop...

Since originally I was following the directions in the book Kubernetes Up and Running 2nd Ed to create a MySQL singleton (since that looked easier than a stateful set) and then discovered Bitnami/MySQL, I had forgotten about stateful sets.

Sooo... I just discovered that bitnami/mysql not only creates svcs, pods, pvcs and pvs but statefulsets (and secrets too) and I had previously only deleted the pvcs after using helm delete my-release.... OK, shame on me for never having deleted the statefullsets & secretes! So I deleted the statefull sets and secrets and deleted everything else (pvcs, pv, svcs) and helm delete m-release and reinstalled bitnami/mysql hoping that the problem would be fixed!

Shucks -- same symptoms!

Perhaps I should manually delete something else in addition to pvcs, pvc, secrets and statefull sets that is not deleted by helm delete?

I've seen elsewhere (other forums) where folks have been able to use bitnami/mysql on docker4desktop/kubernetes... But I suspect it was always the first time and there is something I need to manually delete.... Oh how I wish I had saved that original password!

Perhaps I need to delete my docker4desktop Kubernetes cluster and recreate it? How do I do that? I'm google searching now... Looks like you can do it for MacOS but I don't see the Windows instructions yet... I'll keep looking....

Thanks

Thanks siegfried

rafariossaa commented 3 years ago

Hi,

I tried to use the kubectl port-forwarding feature to run my tutorial app and it appeared to be working (socket connection seemed to succeed) except for the fact I was unable to grant myself sufficient priviledges to access the database via port forwarding.... Is there some security issue that I need to suppress so I can connect from outside the kubernetes cluster?

You should be able to connect using a mysql client with the user root and password returned by helm installcommand. If you create a new user, you can use % as host, that should work. I know this is wide open, but the thing is that you don't exactly know the ip where the connection is coming from. To avoid this, you should deploy your application in kubernetes too.

Perhaps I should manually delete something else in addition to pvcs, pvc, secrets and statefull sets that is not deleted by helm delete? Stateful sets and secrets are deleted by helm delete. Have into account that when you run helm delete and it returns released xxxxx uninstalled that doesn't mean that all the resources are already deleted, it is that helm has "told" kubernete to delete all those resources, and kubernetes will delete them at some point.

Perhaps I need to delete my docker4desktop Kubernetes cluster and recreate it? How do I do that? I am sorry, we don't use docker4destop. We don't know how to delete it, I did a quick search but I could not found anything useful for windows.

siegfried01 commented 3 years ago

After deleting (er, uninstalling) and reinstalling Docker for Windows for desktop I found the reset button... Oh well... I tried bitnami MySQL again and same problem... Shucks...

rafariossaa commented 3 years ago

Hi @siegfried01, My guess it that this issue is related somehow to docker for windows and kubernetes in windows. Maybe you would like to try to use a linux virtual machine and install kubernetes there. I would be interesting also to try other charts and look for a common issue.

siegfried01 commented 3 years ago

Well, like I said, it works on Azure kubernetes which defaults to linux. Would this not be same as installing kubernetes on a new Linux VM?

(I'm a little surprised because I thought the whole point of docker for desktop/kubernetes and its cousin minikube was to run Kubernetes with a Linux VM for developers because installing the real kubernetes would require several machines or VMs... Am I wrong?)

And, Docker for Desktop uses a Linux VM (by default) to host and execute the docker images. I've seen the checkbox to use Windows containers but I have never experimented with it.

rafariossaa commented 3 years ago

Hi,

Well, like I said, it works on Azure kubernetes which defaults to linux. Would this not be same as installing kubernetes on a new Linux VM?

Yes you should be able to that. You can run a linux VM and then install kuberntes and use it as it were the Azure Kubernetes.

I'm a little surprised because I thought ...

Yes, that is the idea behind the whole container thing. I think the issue here is that docker is not natively supported by windows so some tricks are used and some time the devil is in the details.

siegfried01 commented 3 years ago

History: I originally posted here: https://stackoverflow.com/questions/64472740/connecting-to-mysql-5-6-inside-docker-for-desktop-kubernetes-error-1130-hy000 not knowing about helm/bitnami. It looks like there are some problems with the MySQL docker image regarding the binding address in the MySQL configuration. I confirmed that the Docker file for the MySQL docker image referred to in my tutorial "Kubernetes Up and Running 2nd Ed" (KUAR) had removed the binding address of 0.0.0.0 from the MySQL configuration. Apparently this prevents you connecting with a client in another process. This could definitely be a problem!

Then I discovered helm/bitnami and posted in this forum on github figuring that using bitnami/helm was a different topic than my original post on stackoverflow concerning creating my own statful set using KUAR.

And, as you can see, my stackoverflow post suggested helm/bitnami/mysql which I cannot make work -- even after uninstalling and reinstalling docker for desktop/kubernetes.

So is it possible that when I use bitnami/helm/mysql on docker for desktop kubernetes that I am experiencing the same problem as I was when using the tutorial in KUAR? I would need to learn helm better to determine view the Docker file used to create the mysql image that bitnami/helm/mysql is using...

FraPazGal commented 3 years ago

Hello @siegfried01,

From what I read both here and on stackoverflow's post, I'm not sure if there is something missing on your mysql command. The steps I followed to connect to my mysql database using a new pod as a client where:

$ helm install mysql bitnami/mysql
$ echo Password : $(kubectl get secret --namespace default mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode)                     // We'll need this later

$ kubectl run mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.22-debian-10-r23 --namespace default --command -- bash
If you don't see a command prompt, try pressing enter.
I have no name!@mysql-client:/$ mysql -h mysql.default.svc.cluster.local -uroot -p my_database
Enter password:                     // Type here the previous password

Could you try to reproduce this steps and paste the errors logs, if any?

You may experiencing errors like ERROR 1130 (HY000): Host '10.1.0.17' is not allowed to connect to this MySQL server if you are not defining the database you want to connect to.

siegfried01 commented 3 years ago

Thanks for your continued interest and Sorry for the delay!

So I expected this result

$ kubectl run mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.22-debian-10-r23 --namespace default --command -- bash
If you don't see a command prompt, try pressing enter.
I have no name!@mysql-client:/$ mysql -h mysql.default.svc.cluster.local -uroot -p my_database
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql.default.svc.cluster.local' (111)
I have no name!@mysql-client:/$

However, the logs for the master and slave are very similar and they look good (as usual):

 logs pod/mysql-master-0

^[[38;5;6mmysql ^[[38;5;5m05:12:55.52 ^[[0m
^[[38;5;6mmysql ^[[38;5;5m05:12:55.53 ^[[0m^[[1mWelcome to the Bitnami mysql container^[[0m
^[[38;5;6mmysql ^[[38;5;5m05:12:55.53 ^[[0mSubscribe to project updates by watching ^[[1mhttps://github.com/bitnami/bitnami-docker-mysql^[[0m
^[[38;5;6mmysql ^[[38;5;5m05:12:55.53 ^[[0mSubmit issues and feature requests at ^[[1mhttps://github.com/bitnami/bitnami-docker-mysql/issues^[[0m
^[[38;5;6mmysql ^[[38;5;5m05:12:55.53 ^[[0m
^[[38;5;6mmysql ^[[38;5;5m05:12:55.53 ^[[0m^[[38;5;2mINFO ^[[0m ==> ** Starting MySQL setup **
^[[38;5;6mmysql ^[[38;5;5m05:12:55.55 ^[[0m^[[38;5;2mINFO ^[[0m ==> Validating settings in MYSQL_*/MARIADB_* env vars
^[[38;5;6mmysql ^[[38;5;5m05:12:55.56 ^[[0m^[[38;5;2mINFO ^[[0m ==> Initializing mysql database
^[[38;5;6mmysql ^[[38;5;5m05:12:55.58 ^[[0m^[[38;5;3mWARN ^[[0m ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
^[[38;5;6mmysql ^[[38;5;5m05:12:55.58 ^[[0m^[[38;5;2mINFO ^[[0m ==> Using persisted data
^[[38;5;6mmysql ^[[38;5;5m05:12:55.61 ^[[0m^[[38;5;2mINFO ^[[0m ==> Running mysql_upgrade
^[[38;5;6mmysql ^[[38;5;5m05:12:55.62 ^[[0m^[[38;5;2mINFO ^[[0m ==> Starting mysql in background

Here is the same old problem when describing the pod:

 describe pod/mysql-master-0

Name:         mysql-master-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Thu, 26 Nov 2020 21:05:19 -0800
Labels:       app=mysql
              chart=mysql-7.1.0
              component=master
              controller-revision-hash=mysql-master-76d79f8dbc
              heritage=Helm
              release=mysql
              statefulset.kubernetes.io/pod-name=mysql-master-0
Annotations:  <none>
Status:       Running
IP:           10.1.0.48
IPs:
  IP:           10.1.0.48
Controlled By:  StatefulSet/mysql-master
Containers:
  mysql:
    Container ID:   docker://e39a24cd1c109cf55249db138da72f043cb1a6fd269e5864a43a53ac5d94bef5
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r23
    Image ID:       docker-pullable://bitnami/mysql@sha256:33c79419dd2a50046f004eaaa0f1c56e6e82997edb6c4aae4dae54bb85dd568e
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Thu, 26 Nov 2020 21:18:53 -0800
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Thu, 26 Nov 2020 21:15:54 -0800
      Finished:     Thu, 26 Nov 2020 21:18:48 -0800
    Ready:          False
    Restart Count:  4
    Liveness:       exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:               false
      MYSQL_ROOT_PASSWORD:         <set to the key 'mysql-root-password' in secret 'mysql'>  Optional: false
      MYSQL_DATABASE:              my_database
      MYSQL_REPLICATION_MODE:      master
      MYSQL_REPLICATION_USER:      replicator
      MYSQL_REPLICATION_PASSWORD:  <set to the key 'mysql-replication-password' in secret 'mysql'>  Optional: false
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from mysql-token-gkq5d (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-mysql-master-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      mysql-master
    Optional:  false
  mysql-token-gkq5d:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  mysql-token-gkq5d
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  14m                default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
  Warning  FailedScheduling  14m                default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
  Normal   Scheduled         14m                default-scheduler  Successfully assigned default/mysql-master-0 to docker-desktop
  Normal   Pulling           13m                kubelet            Pulling image "docker.io/bitnami/mysql:8.0.22-debian-10-r23"
  Normal   Pulled            12m                kubelet            Successfully pulled image "docker.io/bitnami/mysql:8.0.22-debian-10-r23" in 1m2.2559373s
  Normal   Started           12m                kubelet            Started container mysql
  Warning  Unhealthy         10m (x3 over 10m)  kubelet            Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Normal   Killing    10m                   kubelet  Container mysql failed liveness probe, will be restarted
  Warning  Unhealthy  9m42s                 kubelet  Readiness probe errored: rpc error: code = Unknown desc = container not running (a9e69b44da4fe2a84681de1786dad539c2628d452895d49af3f71d09f6e41a09)
  Normal   Pulled     9m42s                 kubelet  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r23" already present on machine
  Normal   Created    9m39s (x2 over 12m)   kubelet  Created container mysql
  Warning  Unhealthy  3m53s (x42 over 12m)  kubelet  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
**error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'**
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!

For some reason the MySqld is not starting -- possibly because the binding address is not 0.0.0.0?

Thanks

Siegfried

juan131 commented 3 years ago

Hi @siegfried01

It looks like, for some reason, the initalization of MySQL is taking too long (or failing) and, when the readiness probes run the mysqladmin command the database is not ready to accept connections yet.

So.. here you have some steps I recommend you to follow when installing the chart:

mysql 07:03:37.76 INFO  ==> ** Starting MySQL **

Please let us know if following these steps the installation works. And that will give us some hints about the issue.

siegfried01 commented 3 years ago

OK, this looks pretty similar! I manually deleted the pvc from the last experiment. There where no PVCs from this -- probably because the set switch worked...

helm install my-release --set image.debug=true bitnami/mysql --set master.persistence.enabled=false,slave.persistence.enabled=false

Here is the result for describing the pod:

NAME                        READY   STATUS    RESTARTS   AGE     IP          NODE             NOMINATED NODE   READINESS GATES
my-release-mysql-master-0   0/1     Running   0          3m20s   10.1.0.56   docker-desktop   <none>           <none>
my-release-mysql-slave-0    0/1     Running   0          3m20s   10.1.0.55   docker-desktop   <none>           <none>

 describe pod/my-release-mysql-master-0

Name:         my-release-mysql-master-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Sun, 29 Nov 2020 17:59:24 -0800
Labels:       app=mysql
              chart=mysql-7.1.0
              component=master
              controller-revision-hash=my-release-mysql-master-98d5fcc4
              heritage=Helm
              release=my-release
              statefulset.kubernetes.io/pod-name=my-release-mysql-master-0
Annotations:  <none>
Status:       Running
IP:           10.1.0.56
IPs:
  IP:           10.1.0.56
Controlled By:  StatefulSet/my-release-mysql-master
Containers:
  mysql:
    Container ID:   docker://5cc354e5f75760c1e99fadee3a3b07260ea1ee9f6ab757cf517f6931d72a9f8e
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r23
    Image ID:       docker-pullable://bitnami/mysql@sha256:33c79419dd2a50046f004eaaa0f1c56e6e82997edb6c4aae4dae54bb85dd568e
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Sun, 29 Nov 2020 18:09:54 -0800
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Sun, 29 Nov 2020 18:06:46 -0800
      Finished:     Sun, 29 Nov 2020 18:09:45 -0800
    Ready:          False
    Restart Count:  3
    Liveness:       exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [sh -c password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]; then
    password_aux=$(cat $MYSQL_ROOT_PASSWORD_FILE)
fi
mysqladmin status -uroot -p$password_aux
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:               true
      MYSQL_ROOT_PASSWORD:         <set to the key 'mysql-root-password' in secret 'my-release-mysql'>  Optional: false
      MYSQL_DATABASE:              my_database
      MYSQL_REPLICATION_MODE:      master
      MYSQL_REPLICATION_USER:      replicator
      MYSQL_REPLICATION_PASSWORD:  <set to the key 'mysql-replication-password' in secret 'my-release-mysql'>  Optional: false
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-release-mysql-token-jkdzt (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-release-mysql-master
    Optional:  false
  data:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
  my-release-mysql-token-jkdzt:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-release-mysql-token-jkdzt
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                 From               Message
  ----     ------     ----                ----               -------
  Normal   Scheduled  10m                 default-scheduler  Successfully assigned default/my-release-mysql-master-0 to docker-desktop
  Normal   Started    10m                 kubelet            Started container mysql
  Warning  Unhealthy  7m40s (x3 over 8m)  kubelet            Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Normal   Killing    7m40s                  kubelet  Container mysql failed liveness probe, will be restarted
  Warning  Unhealthy  6m58s                  kubelet  Readiness probe errored: rpc error: code = Unknown desc = container not running (119afae8345eb837b851864a69125247328aebd92375ea3b9c706d356e59f732)
  Normal   Created    6m50s (x2 over 10m)    kubelet  Created container mysql
  Warning  Unhealthy  5m9s (x22 over 9m29s)  kubelet  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Normal  Pulled  17s (x4 over 10m)  kubelet  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r23" already present on machine
rafariossaa commented 3 years ago

Hi, Could you also provide the logs ? It should provide more info as @juan131 indicated.

siegfried01 commented 3 years ago

Lucky me! The pods were still running.

NAME                        READY   STATUS             RESTARTS   AGE   IP          NODE             NOMINATED NODE   READINESS GATES
my-release-mysql-master-0   0/1     CrashLoopBackOff   160        15h   10.1.0.56   docker-desktop   <none>           <none>
my-release-mysql-slave-0    0/1     Running            154        15h   10.1.0.55   docker-desktop   <none>           <none>

 logs pod/my-release-mysql-master-0

mysql 17:31:00.35 
mysql 17:31:00.36 Welcome to the Bitnami mysql container
mysql 17:31:00.36 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 17:31:00.36 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 17:31:00.37 
mysql 17:31:00.37 INFO  ==> ** Starting MySQL setup **
mysql 17:31:00.39 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 17:31:00.40 INFO  ==> Initializing mysql database
mysql 17:31:00.40 DEBUG ==> Ensuring expected directories/files exist
mysql 17:31:00.41 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 17:31:00.41 INFO  ==> Using persisted data
mysql 17:31:00.44 INFO  ==> Running mysql_upgrade
mysql 17:31:00.45 INFO  ==> Starting mysql in background
2020-11-30T17:31:00.700610Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 53
2020-11-30T17:31:00.702469Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-11-30T17:31:00.702480Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-11-30T17:31:00.778494Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-30T17:31:03.255431Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-11-30T17:31:03.258437Z 1 [ERROR] [MY-011096] [Server] No data dictionary version number found.
2020-11-30T17:31:03.258887Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-30T17:31:03.259200Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-30T17:31:03.818255Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.

Here are the logs for the slave:

 logs pod/my-release-mysql-slave-0

mysql 17:30:30.33 
mysql 17:30:30.33 Welcome to the Bitnami mysql container
mysql 17:30:30.33 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 17:30:30.34 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 17:30:30.34 
mysql 17:30:30.35 INFO  ==> ** Starting MySQL setup **
mysql 17:30:30.37 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 17:30:30.37 INFO  ==> Initializing mysql database
mysql 17:30:30.38 DEBUG ==> Ensuring expected directories/files exist
mysql 17:30:30.39 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 17:30:30.39 INFO  ==> Using persisted data
mysql 17:30:30.50 INFO  ==> Running mysql_upgrade
mysql 17:30:30.54 INFO  ==> Starting mysql in background
2020-11-30T17:30:30.794439Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 52
2020-11-30T17:30:30.798978Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-11-30T17:30:30.798995Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-11-30T17:30:30.934050Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-30T17:30:33.816642Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-11-30T17:30:33.824024Z 1 [ERROR] [MY-011096] [Server] No data dictionary version number found.
2020-11-30T17:30:33.824693Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-30T17:30:33.825212Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-30T17:30:34.352577Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.
rafariossaa commented 3 years ago

Hi, Right now I am not very sure witch command/parameters are you using to start the chart. By using helm install my-mysql --set image.debug=true bitnami/mysql --set master.persistence.enabled=false,slave.persistence.enabled=false you only get one pod:

NAME                                        READY   STATUS    RESTARTS   AGE
pod/my-mysql-0                              1/1     Running   0          18m

Can you also update your repo information and deploy the lastest version of the chart ? Currently it is 8.0.0. This can be done by:

$ helm repo update
$ helm search repo bitnami/mysql
NAME            CHART VERSION   APP VERSION     DESCRIPTION                                     
bitnami/mysql   8.0.0           8.0.22          Chart to create a Highly available MySQL cluster

And the install it with:

$ helm install my-mysql --set image.debug=true bitnami/mysql --set master.persistence.enabled=false,slave.persistence.enabled=false
siegfried01 commented 3 years ago

Incidently, I was playing with the sample https://www.youtube.com/watch?v=BlX26GThQPQ and the mysql worked fine when I launched it from docker...

However, when I tried to convert it to kubernetes using "kompose convert" and use the resulting yaml files, I got the same old problem....

Here you go... Same as before

$ helm repo update
    Hang tight while we grab the latest from your chart repositories...
    ...Successfully got an update from the "ingress-nginx" chart repository
    ...Successfully got an update from the "jetstack" chart repository
    ...Successfully got an update from the "azure-marketplace" chart repository
    ...Successfully got an update from the "bitnami" chart repository
    ...Successfully got an update from the "stable" chart repository
    Update Complete. *** Happy Helming!*** 
$ helm search repo bitnami/mysql
    NAME            CHART VERSION   APP VERSION DESCRIPTION                                     
    bitnami/mysql   8.0.0           8.0.22      Chart to create a Highly available MySQL cluster
$ helm install my-mysql --set image.debug=true bitnami/mysql --set master.persistence.enabled=false,slave.persistence.enabled=false
     NAME: my-mysql
     LAST DEPLOYED: Thu Dec  3 14:04:58 2020
     NAMESPACE: default
     STATUS: deployed
     REVISION: 1
     TEST SUITE: None
     NOTES:
...
$ k get logs pod/my-mysql-0
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.66 ^[[0m
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.67 ^[[0m^[[1mWelcome to the Bitnami mysql container^[[0m
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.68 ^[[0mSubscribe to project updates by watching ^[[1mhttps://github.com/bitnami/bitnami-docker-mysql^[[0m
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.68 ^[[0mSubmit issues and feature requests at ^[[1mhttps://github.com/bitnami/bitnami-docker-mysql/issues^[[0m
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.69 ^[[0m
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.69 ^[[0m^[[38;5;2mINFO ^[[0m ==> ** Starting MySQL setup **
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.75 ^[[0m^[[38;5;2mINFO ^[[0m ==> Validating settings in MYSQL_*/MARIADB_* env vars
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.77 ^[[0m^[[38;5;2mINFO ^[[0m ==> Initializing mysql database
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.79 ^[[0m^[[38;5;5mDEBUG^[[0m ==> Ensuring expected directories/files exist
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.84 ^[[0m^[[38;5;3mWARN ^[[0m ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.85 ^[[0m^[[38;5;5mDEBUG^[[0m ==> Cleaning data directory to ensure successfully initialization
    ^[[38;5;6mmysql ^[[38;5;5m22:05:14.85 ^[[0m^[[38;5;2mINFO ^[[0m ==> Installing database
    2020-12-03T22:05:14.908738Z 0 [System] [MY-013169] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 32
    2020-12-03T22:05:14.911574Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
    2020-12-03T22:05:14.911590Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
    2020-12-03T22:05:14.945812Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    2020-12-03T22:05:42.236686Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
$ kubectl get pods 
    NAME         READY   STATUS    RESTARTS   AGE   IP          NODE             NOMINATED NODE   READINESS GATES
    my-mysql-0   0/1     Running   0          60s   10.1.0.71   docker-desktop   <none>           <none>    
$ k describe pod/my-mysql-0

    Name:         my-mysql-0
    Namespace:    default
    Priority:     0
    Node:         docker-desktop/192.168.65.3
    Start Time:   Thu, 03 Dec 2020 14:05:04 -0800
    Labels:       app.kubernetes.io/component=primary
                  app.kubernetes.io/instance=my-mysql
                  app.kubernetes.io/managed-by=Helm
                  app.kubernetes.io/name=mysql
                  controller-revision-hash=my-mysql-bc9bcd7d8
                  helm.sh/chart=mysql-8.0.0
                  statefulset.kubernetes.io/pod-name=my-mysql-0
    Annotations:  checksum/configuration: ae55a7b42d8ee9f5c91f665af53d035fc724f4e25ece5d9e25214ed02f04af23
    Status:       Running
    IP:           10.1.0.71
    IPs:
      IP:           10.1.0.71
    Controlled By:  StatefulSet/my-mysql
    Containers:
      mysql:
        Container ID:   docker://d1b843d3a4ea5c3a80cffed54f403007692e0ce2ed6c563ef4f3cb659f8b99cf
        Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r23
        Image ID:       docker-pullable://bitnami/mysql@sha256:33c79419dd2a50046f004eaaa0f1c56e6e82997edb6c4aae4dae54bb85dd568e
        Port:           3306/TCP
        Host Port:      0/TCP
        State:          Running
          Started:      Thu, 03 Dec 2020 14:05:14 -0800
        Ready:          False
        Restart Count:  0
        Liveness:       exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
    if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
        password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
    fi
    mysqladmin status -uroot -p"${password_aux}"
    ] delay=120s timeout=1s period=10s #success=1 #failure=3
        Readiness:  exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
    if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
        password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
    fi
    mysqladmin status -uroot -p"${password_aux}"
    ] delay=30s timeout=1s period=10s #success=1 #failure=3
        Environment:
          BITNAMI_DEBUG:        true
          MYSQL_ROOT_PASSWORD:  <set to the key 'mysql-root-password' in secret 'my-mysql'>  Optional: false
          MYSQL_DATABASE:       my_database
        Mounts:
          /bitnami/mysql from data (rw)
          /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
          /var/run/secrets/kubernetes.io/serviceaccount from my-mysql-token-blv66 (ro)
    Conditions:
      Type              Status
      Initialized       True 
      Ready             False 
      ContainersReady   False 
      PodScheduled      True 
    Volumes:
      data:
        Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
        ClaimName:  data-my-mysql-0
        ReadOnly:   false
      config:
        Type:      ConfigMap (a volume populated by a ConfigMap)
        Name:      my-mysql
        Optional:  false
      my-mysql-token-blv66:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  my-mysql-token-blv66
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  <none>
    Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                     node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
    Events:
      Type     Reason            Age               From               Message
      ----     ------            ----              ----               -------
      Warning  FailedScheduling  111s              default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
      Warning  FailedScheduling  110s              default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
      Normal   Scheduled         108s              default-scheduler  Successfully assigned default/my-mysql-0 to docker-desktop
      Normal   Pulled            102s              kubelet            Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r23" already present on machine
      Normal   Created           99s               kubelet            Created container mysql
      Normal   Started           97s               kubelet            Started container mysql
      Warning  Unhealthy         9s (x6 over 59s)  kubelet            Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
    mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
juan131 commented 3 years ago

Hi @siegfried01

It looks to me like your MySQL server is taking too long to start.. So the readiness/liveness probes fail since MySQL is not accepting connections yet when these probes start to use mysqladmin to check the status.

Let's try with two different approaches:

Try both approaches and give it some time to MySQL to start the server. You should see a message like the one in the logs:

mysql 11:17:45.30 INFO  ==> ** MySQL setup finished! **
mysql 11:17:45.33 INFO  ==> ** Starting MySQL **
siegfried01 commented 3 years ago

Shucks -- same results...

Attempt #1 helm install my-mysql bitnami/mysql --set image.debug=true --set master.persistence.enabled=false,slave.persistence.enabled=false --set readinessProbe.initialDelaySeconds=300,livenessProbe.initialDelaySeconds=300

NAME         READY   STATUS    RESTARTS   AGE   IP          NODE             NOMINATED NODE   READINESS GATES
my-mysql-0   0/1     Running   0          58s   10.1.0.93   docker-desktop   <none>           <none>

 logs pod/my-mysql-0

[38;5;6mmysql [38;5;5m18:44:13.17 [0m
[38;5;6mmysql [38;5;5m18:44:13.17 [0m[1mWelcome to the Bitnami mysql container[0m
[38;5;6mmysql [38;5;5m18:44:13.17 [0mSubscribe to project updates by watching [1mhttps://github.com/bitnami/bitnami-docker-mysql[0m
[38;5;6mmysql [38;5;5m18:44:13.17 [0mSubmit issues and feature requests at [1mhttps://github.com/bitnami/bitnami-docker-mysql/issues[0m
[38;5;6mmysql [38;5;5m18:44:13.17 [0m
[38;5;6mmysql [38;5;5m18:44:13.18 [0m[38;5;2mINFO [0m ==> ** Starting MySQL setup **
[38;5;6mmysql [38;5;5m18:44:13.19 [0m[38;5;2mINFO [0m ==> Validating settings in MYSQL_*/MARIADB_* env vars
[38;5;6mmysql [38;5;5m18:44:13.20 [0m[38;5;2mINFO [0m ==> Initializing mysql database
[38;5;6mmysql [38;5;5m18:44:13.20 [0m[38;5;5mDEBUG[0m ==> Ensuring expected directories/files exist
[38;5;6mmysql [38;5;5m18:44:13.21 [0m[38;5;3mWARN [0m ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
[38;5;6mmysql [38;5;5m18:44:13.22 [0m[38;5;2mINFO [0m ==> Using persisted data
[38;5;6mmysql [38;5;5m18:44:13.31 [0m[38;5;2mINFO [0m ==> Running mysql_upgrade
[38;5;6mmysql [38;5;5m18:44:13.32 [0m[38;5;2mINFO [0m ==> Starting mysql in background
2020-12-09T18:44:13.874949Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 50
2020-12-09T18:44:13.881109Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-09T18:44:13.881121Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-09T18:44:13.964297Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-09T18:44:18.319187Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-09T18:44:18.354187Z 1 [ERROR] [MY-011096] [Server] No data dictionary version number found.
2020-12-09T18:44:18.355294Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-12-09T18:44:18.355930Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-12-09T18:44:18.874321Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.

NAME         READY   STATUS    RESTARTS   AGE   IP          NODE             NOMINATED NODE   READINESS GATES
my-mysql-0   0/1     Running   0          58s   10.1.0.93   docker-desktop   <none>           <none>

 describe pod/my-mysql-0

Name:         my-mysql-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Wed, 09 Dec 2020 10:34:36 -0800
Labels:       app.kubernetes.io/component=primary
              app.kubernetes.io/instance=my-mysql
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=mysql
              controller-revision-hash=my-mysql-bc9bcd7d8
              helm.sh/chart=mysql-8.0.0
              statefulset.kubernetes.io/pod-name=my-mysql-0
Annotations:  checksum/configuration: ae55a7b42d8ee9f5c91f665af53d035fc724f4e25ece5d9e25214ed02f04af23
Status:       Running
IP:           10.1.0.93
IPs:
  IP:           10.1.0.93
Controlled By:  StatefulSet/my-mysql
Containers:
  mysql:
    Container ID:   docker://ac6c95654f09c2c3dc83421d63c4c6ceb571e73b668b9850adeb71170ccf4fe8
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r23
    Image ID:       docker-pullable://bitnami/mysql@sha256:33c79419dd2a50046f004eaaa0f1c56e6e82997edb6c4aae4dae54bb85dd568e
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Wed, 09 Dec 2020 10:47:16 -0800
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Wed, 09 Dec 2020 10:44:13 -0800
      Finished:     Wed, 09 Dec 2020 10:47:07 -0800
    Ready:          False
    Restart Count:  4
    Liveness:       exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:        true
      MYSQL_ROOT_PASSWORD:  <set to the key 'mysql-root-password' in secret 'my-mysql'>  Optional: false
      MYSQL_DATABASE:       my_database
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-mysql-token-lgfh6 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-my-mysql-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-mysql
    Optional:  false
  my-mysql-token-lgfh6:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-mysql-token-lgfh6
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  13m                default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
  Normal   Scheduled         13m                default-scheduler  Successfully assigned default/my-mysql-0 to docker-desktop
  Normal   Started           12m                kubelet            Started container mysql
  Warning  Unhealthy         10m (x3 over 10m)  kubelet            Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Normal   Killing    10m                   kubelet  Container mysql failed liveness probe, will be restarted
  Normal   Pulled     9m38s (x2 over 12m)   kubelet  Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r23" already present on machine
  Warning  Unhealthy  9m37s                 kubelet  Readiness probe errored: rpc error: code = Unknown desc = container not running (0931c8168a268cf6b061027107d262c98ca3781213ee31ea89f2ffbc98972cb7)
  Normal   Created    9m35s (x2 over 12m)   kubelet  Created container mysql
  Warning  Unhealthy  2m37s (x48 over 12m)  kubelet  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!

Attempt #
helm install my-mysql bitnami/mysql --set image.debug=true
--set master.persistence.enabled=false,slave.persistence.enabled=false
--set readinessProbe.enabled=false,livenessProbe.enabled=false

NAME         READY   STATUS    RESTARTS   AGE    IP          NODE             NOMINATED NODE   READINESS GATES
my-mysql-0   0/1     Running   0          103s   10.1.0.94   docker-desktop   <none>           <none>

 logs pod/my-mysql-0

[38;5;6mmysql [38;5;5m19:23:45.58 [0m
[38;5;6mmysql [38;5;5m19:23:45.58 [0m[1mWelcome to the Bitnami mysql container[0m
[38;5;6mmysql [38;5;5m19:23:45.58 [0mSubscribe to project updates by watching [1mhttps://github.com/bitnami/bitnami-docker-mysql[0m
[38;5;6mmysql [38;5;5m19:23:45.59 [0mSubmit issues and feature requests at [1mhttps://github.com/bitnami/bitnami-docker-mysql/issues[0m
[38;5;6mmysql [38;5;5m19:23:45.59 [0m
[38;5;6mmysql [38;5;5m19:23:45.60 [0m[38;5;2mINFO [0m ==> ** Starting MySQL setup **
[38;5;6mmysql [38;5;5m19:23:45.64 [0m[38;5;2mINFO [0m ==> Validating settings in MYSQL_*/MARIADB_* env vars
[38;5;6mmysql [38;5;5m19:23:45.66 [0m[38;5;2mINFO [0m ==> Initializing mysql database
[38;5;6mmysql [38;5;5m19:23:45.66 [0m[38;5;5mDEBUG[0m ==> Ensuring expected directories/files exist
[38;5;6mmysql [38;5;5m19:23:45.69 [0m[38;5;3mWARN [0m ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
[38;5;6mmysql [38;5;5m19:23:45.70 [0m[38;5;5mDEBUG[0m ==> Cleaning data directory to ensure successfully initialization
[38;5;6mmysql [38;5;5m19:23:45.70 [0m[38;5;2mINFO [0m ==> Installing database
2020-12-09T19:23:45.903180Z 0 [System] [MY-013169] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 33
2020-12-09T19:23:45.908078Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-09T19:23:45.908120Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-09T19:23:45.949182Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-09T19:24:10.489618Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

NAME         READY   STATUS    RESTARTS   AGE    IP          NODE             NOMINATED NODE   READINESS GATES
my-mysql-0   0/1     Running   0          103s   10.1.0.94   docker-desktop   <none>           <none>

 describe pod/my-mysql-0

Name:         my-mysql-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Wed, 09 Dec 2020 11:23:34 -0800
Labels:       app.kubernetes.io/component=primary
              app.kubernetes.io/instance=my-mysql
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=mysql
              controller-revision-hash=my-mysql-bc9bcd7d8
              helm.sh/chart=mysql-8.0.0
              statefulset.kubernetes.io/pod-name=my-mysql-0
Annotations:  checksum/configuration: ae55a7b42d8ee9f5c91f665af53d035fc724f4e25ece5d9e25214ed02f04af23
Status:       Running
IP:           10.1.0.94
IPs:
  IP:           10.1.0.94
Controlled By:  StatefulSet/my-mysql
Containers:
  mysql:
    Container ID:   docker://8259b2bb226807c93f87b1293ed2f74337739541cbd3546940973b0cd8fd4303
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r23
    Image ID:       docker-pullable://bitnami/mysql@sha256:33c79419dd2a50046f004eaaa0f1c56e6e82997edb6c4aae4dae54bb85dd568e
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Wed, 09 Dec 2020 11:23:45 -0800
    Ready:          False
    Restart Count:  0
    Liveness:       exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:        true
      MYSQL_ROOT_PASSWORD:  <set to the key 'mysql-root-password' in secret 'my-mysql'>  Optional: false
      MYSQL_DATABASE:       my_database
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-mysql-token-xc4f5 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-my-mysql-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-mysql
    Optional:  false
  my-mysql-token-xc4f5:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-mysql-token-xc4f5
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  2m3s (x2 over 2m4s)  default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
  Normal   Scheduled         2m1s                 default-scheduler  Successfully assigned default/my-mysql-0 to docker-desktop
  Normal   Pulled            113s                 kubelet            Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r23" already present on machine
  Normal   Created           110s                 kubelet            Created container mysql
  Normal   Started           109s                 kubelet            Started container mysql
  Warning  Unhealthy         9s (x7 over 69s)     kubelet            Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
juan131 commented 3 years ago

Hi @juan131

In the first logs you shared, I can see:

[38;5;6mmysql [38;5;5m18:44:13.22 [0m[38;5;2mINFO [0m ==> Using persisted data
[38;5;6mmysql [38;5;5m18:44:13.31 [0m[38;5;2mINFO [0m ==> Running mysql_upgrade

That means that you didn't install the chart in a "clean" environment. I mean, without removing existing PVCs from previous installations. Find detailed information in this guide.

Regarding the second installation, the errors below indicate that the probes are being executed:

  Warning  Unhealthy         9s (x7 over 69s)     kubelet            Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
�mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!

That's my fault since the flags to disable the probes are --set primary.readinessProbe.enabled=false,primary.livenessProbe.enabled=false instead of --set readinessProbe.enabled=false,livenessProbe.enabled=false. My apolizes.

These are the correct commands to use:

$ helm install my-mysql bitnami/mysql \
    --set image.debug=true \
    --set primary.persistence.enabled=false,secondary.persistence.enabled=false \
    --set primary.readinessProbe.initialDelaySeconds=300,primary.livenessProbe.initialDelaySeconds=300 \
    --set secondary.readinessProbe.initialDelaySeconds=300,secondary.livenessProbe.initialDelaySeconds=300

Approach B

$ helm install my-mysql bitnami/mysql \
    --set image.debug=true \
    --set primary.persistence.enabled=false,secondary.persistence.enabled=false \
    --set primary.readinessProbe.enabled=false,primary.livenessProbe.enabled=false \
    --set secondary.readinessProbe.enabled=false,secondary.livenessProbe.enabled=false

Please upgrade your the helm repo running the command below before installing the chart:

$ helm repo update
siegfried01 commented 3 years ago
Yahoo! Attempt B worked. Attempt A did not. Thank you very much!

begin Attempt A

Compilation started at Thu Dec 10 17:06:31

helm install my-mysql bitnami/mysql \
    --set image.debug=true \
    --set primary.persistence.enabled=false,secondary.persistence.enabled=false \
    --set primary.readinessProbe.initialDelaySeconds=300,primary.livenessProbe.initialDelaySeconds=300 \
    --set secondary.readinessProbe.initialDelaySeconds=300,secondary.livenessProbe.initialDelaySeconds=300
NAME: my-mysql
LAST DEPLOYED: Thu Dec 10 17:06:35 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **

Tip:

  Watch the deployment status using the command: kubectl get pods -w --namespace default

Services:

  echo Primary: my-mysql.default.svc.cluster.local:3306

Administrator credentials:

  echo Username: root
  echo Password : $(kubectl get secret --namespace default my-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode)

To connect to your database:

  1. Run a pod that you can use as a client:

      kubectl run my-mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.22-debian-10-r44 --namespace default --command -- bash

  2. To connect to primary service (read/write):

      mysql -h my-mysql.default.svc.cluster.local -uroot -p my_database

To upgrade this helm chart:

  1. Obtain the password as described on the 'Administrator credentials' section and set the 'root.password' parameter as shown below:

      ROOT_PASSWORD=$(kubectl get secret --namespace default my-mysql} -o jsonpath="{.data.mysql-root-password}" | base64 --decode)
      helm upgrade my-mysql bitnami/mysql --set auth.rootPassword=$ROOT_PASSWORD

Compilation finished at Thu Dec 10 17:06:38

Compilation started at Thu Dec 10 17:07:38

kubectl get secret --namespace default my-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode
rRIJpRs0Bn
Compilation finished at Thu Dec 10 17:07:39

NAMESPACE     NAME                                     READY   STATUS    RESTARTS   AGE     IP             NODE             NOMINATED NODE   READINESS GATES
default       my-mysql-0                               0/1     Running   0          3m42s   10.1.0.103     docker-desktop   <none>           <none>
kube-system   coredns-f9fd979d6-477z4                  1/1     Running   16         36d     10.1.0.97      docker-desktop   <none>           <none>
kube-system   coredns-f9fd979d6-p7dtz                  1/1     Running   16         36d     10.1.0.99      docker-desktop   <none>           <none>
kube-system   etcd-docker-desktop                      1/1     Running   36         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-apiserver-docker-desktop            1/1     Running   82         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-controller-manager-docker-desktop   1/1     Running   37         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-proxy-6jl9c                         1/1     Running   16         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-scheduler-docker-desktop            1/1     Running   391        36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   storage-provisioner                      1/1     Running   338        36d     10.1.0.100     docker-desktop   <none>           <none>
kube-system   vpnkit-controller                        1/1     Running   16         36d     10.1.0.98      docker-desktop   <none>           <none>

 logs pod/my-mysql-0

mysql 01:06:48.31 
mysql 01:06:48.31 Welcome to the Bitnami mysql container
mysql 01:06:48.32 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 01:06:48.33 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 01:06:48.33 
mysql 01:06:48.34 INFO  ==> ** Starting MySQL setup **
mysql 01:06:48.40 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 01:06:48.41 INFO  ==> Initializing mysql database
mysql 01:06:48.42 DEBUG ==> Ensuring expected directories/files exist
mysql 01:06:48.45 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 01:06:48.45 DEBUG ==> Cleaning data directory to ensure successfully initialization
mysql 01:06:48.46 INFO  ==> Installing database
2020-12-11T01:06:48.500453Z 0 [System] [MY-013169] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 34
2020-12-11T01:06:48.503623Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T01:06:48.503637Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T01:06:48.523180Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T01:07:14.615242Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T01:08:49.044538Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
mysql 01:11:17.35 INFO  ==> Starting mysql in background
2020-12-11T01:11:17.674946Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 82
2020-12-11T01:11:17.686123Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T01:11:17.686143Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T01:11:17.803396Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T01:11:19.910320Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T01:11:20.587969Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-12-11T01:11:23.578509Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-11T01:11:23.579078Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-11T01:11:23.906040Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.22'  socket: '/opt/bitnami/mysql/tmp/mysql.sock'  port: 3306  Source distribution.
mysql 01:11:25.38 DEBUG ==> Executing SQL command:
select 1
1
mysql 01:11:25.40 INFO  ==> Configuring authentication
mysql 01:11:25.41 DEBUG ==> Executing SQL command:
DELETE FROM mysql.user WHERE user not in ('mysql.sys','mariadb.sys');
mysql 01:11:25.88 DEBUG ==> Configuring root user credentials
mysql 01:11:25.89 DEBUG ==> Executing SQL command:
-- create admin user
create user 'root'@'%' identified by 'rRIJpRs0Bn';
grant all on *.* to 'root'@'%' with grant option;
flush privileges;
mysql 01:11:27.92 DEBUG ==> removing the unknown user
mysql 01:11:27.93 DEBUG ==> Executing SQL command:
select Host from user where User='';
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql 01:11:27.95 DEBUG ==> Creating database my_database
mysql 01:11:27.95 DEBUG ==> Executing SQL command:
create database if not exists `my_database` ;
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql 01:11:28.49 INFO  ==> Running mysql_upgrade
mysql 01:11:28.50 INFO  ==> Stopping mysql
2020-12-11T01:11:28.514010Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.22).
2020-12-11T01:11:33.673934Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.
mysql 01:11:34.54 INFO  ==> Starting mysql in background
2020-12-11T01:11:34.824743Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 191
2020-12-11T01:11:34.828565Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T01:11:34.828580Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T01:11:34.843990Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T01:11:37.148815Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T01:11:37.627273Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-12-11T01:11:37.687817Z 4 [System] [MY-013381] [Server] Server upgrade from '80022' to '80022' started.

NAMESPACE     NAME                                     READY   STATUS    RESTARTS   AGE     IP             NODE             NOMINATED NODE   READINESS GATES
default       my-mysql-0                               0/1     Running   0          3m42s   10.1.0.103     docker-desktop   <none>           <none>
kube-system   coredns-f9fd979d6-477z4                  1/1     Running   16         36d     10.1.0.97      docker-desktop   <none>           <none>
kube-system   coredns-f9fd979d6-p7dtz                  1/1     Running   16         36d     10.1.0.99      docker-desktop   <none>           <none>
kube-system   etcd-docker-desktop                      1/1     Running   36         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-apiserver-docker-desktop            1/1     Running   82         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-controller-manager-docker-desktop   1/1     Running   37         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-proxy-6jl9c                         1/1     Running   16         36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   kube-scheduler-docker-desktop            1/1     Running   391        36d     192.168.65.3   docker-desktop   <none>           <none>
kube-system   storage-provisioner                      1/1     Running   338        36d     10.1.0.100     docker-desktop   <none>           <none>
kube-system   vpnkit-controller                        1/1     Running   16         36d     10.1.0.98      docker-desktop   <none>           <none>

 describe pod/my-mysql-0

Name:         my-mysql-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Thu, 10 Dec 2020 17:06:38 -0800
Labels:       app.kubernetes.io/component=primary
              app.kubernetes.io/instance=my-mysql
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=mysql
              controller-revision-hash=my-mysql-5b5d4cc9ff
              helm.sh/chart=mysql-8.2.1
              statefulset.kubernetes.io/pod-name=my-mysql-0
Annotations:  checksum/configuration: 063332e2dcc3d92437439091b32f2ef72764672f79964488ad4d81646941cc8f
Status:       Running
IP:           10.1.0.103
IPs:
  IP:           10.1.0.103
Controlled By:  StatefulSet/my-mysql
Containers:
  mysql:
    Container ID:   docker://aee5e296dcf3c3b10d3b6b7c9f2cdb32bf5c79b2c35086e9216d24e08d102781
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r44
    Image ID:       docker-pullable://bitnami/mysql@sha256:3ffd066da0331310857607aef3f025f688648fc36c3a0b46df0bda3081666dc8
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Thu, 10 Dec 2020 17:12:51 -0800
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Thu, 10 Dec 2020 17:06:48 -0800
      Finished:     Thu, 10 Dec 2020 17:12:47 -0800
    Ready:          False
    Restart Count:  1
    Liveness:       exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=300s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [/bin/bash -ec password_aux="${MYSQL_ROOT_PASSWORD:-}"
if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=300s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:        true
      MYSQL_ROOT_PASSWORD:  <set to the key 'mysql-root-password' in secret 'my-mysql'>  Optional: false
      MYSQL_DATABASE:       my_database
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-mysql-token-dqv8t (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-mysql
    Optional:  false
  data:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
  my-mysql-token-dqv8t:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-mysql-token-dqv8t
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  11m                  default-scheduler  Successfully assigned default/my-mysql-0 to docker-desktop
  Normal   Killing    6m                   kubelet            Container mysql failed liveness probe, will be restarted
  Normal   Pulled     5m28s (x2 over 11m)  kubelet            Container image "docker.io/bitnami/mysql:8.0.22-debian-10-r44" already present on machine
  Normal   Created    5m26s (x2 over 11m)  kubelet            Created container mysql
  Normal   Started    5m25s (x2 over 11m)  kubelet            Started container mysql
  Warning  Unhealthy  10s (x5 over 6m20s)  kubelet            Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
  Warning  Unhealthy  1s (x9 over 6m21s)  kubelet  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!

$ kubectl run my-mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.22-debian-10-r44 --namespace default --command -- bash
If you don't see a command prompt, try pressing enter.
I have no name!@my-mysql-client:/$ mysql -h my-mysql.default.svc.cluster.local -uroot -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'my-mysql.default.svc.cluster.local' (111)
I have no name!@my-mysql-client:/$ mysql -h my-mysql.default.svc.cluster.local -uroot -p
Enter password:

begin Attempt B

Compilation started at Thu Dec 10 16:39:18

helm install my-mysql bitnami/mysql \
    --set image.debug=true \
    --set primary.persistence.enabled=false,secondary.persistence.enabled=false \
    --set primary.readinessProbe.enabled=false,primary.livenessProbe.enabled=false \
    --set secondary.readinessProbe.enabled=false,secondary.livenessProbe.enabled=false
NAME: my-mysql
LAST DEPLOYED: Thu Dec 10 16:39:22 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **

Tip:

  Watch the deployment status using the command: kubectl get pods -w --namespace default

Services:

  echo Primary: my-mysql.default.svc.cluster.local:3306

Administrator credentials:

  echo Username: root
  echo Password : $(kubectl get secret --namespace default my-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode)

To connect to your database:

  1. Run a pod that you can use as a client:

      kubectl run my-mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.22-debian-10-r44 --namespace default --command -- bash

  2. To connect to primary service (read/write):

      mysql -h my-mysql.default.svc.cluster.local -uroot -p my_database

To upgrade this helm chart:

  1. Obtain the password as described on the 'Administrator credentials' section and set the 'root.password' parameter as shown below:

      ROOT_PASSWORD=$(kubectl get secret --namespace default my-mysql} -o jsonpath="{.data.mysql-root-password}" | base64 --decode)
      helm upgrade my-mysql bitnami/mysql --set auth.rootPassword=$ROOT_PASSWORD

Compilation finished at Thu Dec 10 16:39:25

Compilation started at Thu Dec 10 16:47:59

kubectl get secret --namespace default my-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode
fHgO4SLpNt
Compilation finished at Thu Dec 10 16:48:00

NAME              READY   STATUS    RESTARTS   AGE   IP           NODE             NOMINATED NODE   READINESS GATES
my-mysql-0        1/1     Running   0          11m   10.1.0.101   docker-desktop   <none>           <none>
my-mysql-client   1/1     Running   0          91s   10.1.0.102   docker-desktop   <none>           <none>

 describe pod/my-mysql-0

Name:         my-mysql-0
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.3
Start Time:   Thu, 10 Dec 2020 16:39:25 -0800
Labels:       app.kubernetes.io/component=primary
              app.kubernetes.io/instance=my-mysql
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=mysql
              controller-revision-hash=my-mysql-76756c4fcd
              helm.sh/chart=mysql-8.2.1
              statefulset.kubernetes.io/pod-name=my-mysql-0
Annotations:  checksum/configuration: 063332e2dcc3d92437439091b32f2ef72764672f79964488ad4d81646941cc8f
Status:       Running
IP:           10.1.0.101
IPs:
  IP:           10.1.0.101
Controlled By:  StatefulSet/my-mysql
Containers:
  mysql:
    Container ID:   docker://21a394e19fa199d2273ad8834cdc863c86435582d654dc4f3c7a2713a8e23b4a
    Image:          docker.io/bitnami/mysql:8.0.22-debian-10-r44
    Image ID:       docker-pullable://bitnami/mysql@sha256:3ffd066da0331310857607aef3f025f688648fc36c3a0b46df0bda3081666dc8
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Thu, 10 Dec 2020 16:40:59 -0800
    Ready:          True
    Restart Count:  0
    Environment:
      BITNAMI_DEBUG:        true
      MYSQL_ROOT_PASSWORD:  <set to the key 'mysql-root-password' in secret 'my-mysql'>  Optional: false
      MYSQL_DATABASE:       my_database
    Mounts:
      /bitnami/mysql from data (rw)
      /opt/bitnami/mysql/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from my-mysql-token-stsf2 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      my-mysql
    Optional:  false
  data:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
  my-mysql-token-stsf2:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-mysql-token-stsf2
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  12m   default-scheduler  Successfully assigned default/my-mysql-0 to docker-desktop
  Normal  Pulling    12m   kubelet            Pulling image "docker.io/bitnami/mysql:8.0.22-debian-10-r44"
  Normal  Pulled     11m   kubelet            Successfully pulled image "docker.io/bitnami/mysql:8.0.22-debian-10-r44" in 1m10.7694806s
  Normal  Created    10m   kubelet            Created container mysql
  Normal  Started    10m   kubelet            Started container mysql

NAME              READY   STATUS    RESTARTS   AGE   IP           NODE             NOMINATED NODE   READINESS GATES
my-mysql-0        1/1     Running   0          11m   10.1.0.101   docker-desktop   <none>           <none>
my-mysql-client   1/1     Running   0          91s   10.1.0.102   docker-desktop   <none>           <none>

 logs pod/my-mysql-0

mysql 00:40:59.81 
mysql 00:40:59.81 Welcome to the Bitnami mysql container
mysql 00:40:59.81 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mysql
mysql 00:40:59.82 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mysql/issues
mysql 00:40:59.82 
mysql 00:40:59.82 INFO  ==> ** Starting MySQL setup **
mysql 00:40:59.84 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 00:40:59.85 INFO  ==> Initializing mysql database
mysql 00:40:59.85 DEBUG ==> Ensuring expected directories/files exist
mysql 00:40:59.87 WARN  ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mysql 00:40:59.88 DEBUG ==> Cleaning data directory to ensure successfully initialization
mysql 00:40:59.88 INFO  ==> Installing database
2020-12-11T00:40:59.920872Z 0 [System] [MY-013169] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 34
2020-12-11T00:40:59.922090Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T00:40:59.922100Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T00:40:59.930893Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T00:41:29.570921Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T00:42:50.714664Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
mysql 00:45:14.90 INFO  ==> Starting mysql in background
2020-12-11T00:45:15.189843Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 83
2020-12-11T00:45:15.193262Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T00:45:15.193278Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T00:45:15.284356Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T00:45:17.427039Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T00:45:17.928857Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-12-11T00:45:21.291305Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-11T00:45:21.292866Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-11T00:45:21.519234Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.22'  socket: '/opt/bitnami/mysql/tmp/mysql.sock'  port: 3306  Source distribution.
mysql 00:45:22.92 DEBUG ==> Executing SQL command:
select 1
1
mysql 00:45:22.95 INFO  ==> Configuring authentication
mysql 00:45:22.96 DEBUG ==> Executing SQL command:
DELETE FROM mysql.user WHERE user not in ('mysql.sys','mariadb.sys');
mysql 00:45:23.83 DEBUG ==> Configuring root user credentials
mysql 00:45:23.83 DEBUG ==> Executing SQL command:
-- create admin user
create user 'root'@'%' identified by 'fHgO4SLpNt';
grant all on *.* to 'root'@'%' with grant option;
flush privileges;
mysql 00:45:26.27 DEBUG ==> removing the unknown user
mysql 00:45:26.27 DEBUG ==> Executing SQL command:
select Host from user where User='';
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql 00:45:26.29 DEBUG ==> Creating database my_database
mysql 00:45:26.30 DEBUG ==> Executing SQL command:
create database if not exists `my_database` ;
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql 00:45:26.84 INFO  ==> Running mysql_upgrade
mysql 00:45:26.85 INFO  ==> Stopping mysql
2020-12-11T00:45:26.865046Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.22).
2020-12-11T00:45:32.839109Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.
mysql 00:45:33.88 INFO  ==> Starting mysql in background
2020-12-11T00:45:34.204384Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 192
2020-12-11T00:45:34.208083Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T00:45:34.208103Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T00:45:34.275493Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T00:45:36.084522Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T00:45:36.641706Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-12-11T00:45:36.677700Z 4 [System] [MY-013381] [Server] Server upgrade from '80022' to '80022' started.
2020-12-11T00:53:26.423937Z 4 [System] [MY-013381] [Server] Server upgrade from '80022' to '80022' completed.
2020-12-11T00:53:34.178648Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-11T00:53:34.178915Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-11T00:53:34.551281Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.22'  socket: '/opt/bitnami/mysql/tmp/mysql.sock'  port: 3306  Source distribution.
mysql 00:53:34.74 INFO  ==> Stopping mysql
2020-12-11T00:53:34.746406Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.22).
mysql 00:53:44.76 INFO  ==> Stopping mysql
mysql 00:53:54.79 INFO  ==> ** MySQL setup finished! **

mysql 00:53:54.81 INFO  ==> ** Starting MySQL **
2020-12-11T00:53:55.175066Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.22) starting as process 1
2020-12-11T00:53:55.179030Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-11T00:53:55.179043Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2020-12-11T00:53:55.328255Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-11T00:53:55.355851Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:53:56.356636Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:53:57.357096Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:53:58.357584Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:53:59.358090Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:00.358581Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:01.359069Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:02.359619Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:03.360344Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:04.361091Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:05.361835Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:06.362540Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:07.363215Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:08.363896Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:09.364573Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:10.365461Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:11.366184Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:12.366941Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:13.367654Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:14.368433Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:15.369295Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:16.370073Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:17.370811Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:18.371656Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:19.372514Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:20.373313Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:21.374543Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:22.375435Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:23.376225Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:24.377088Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:25.378098Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:26.379035Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:27.379889Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:28.381302Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:29.382413Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:30.383361Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:31.384361Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:32.385376Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:33.386374Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:34.387286Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:35.388321Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:36.389630Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:37.390737Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:38.391902Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:39.393180Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:40.394280Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:41.395319Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:42.396483Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:43.397481Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:44.398657Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:45.399805Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:46.401200Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:47.402773Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:48.404550Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:49.405591Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:50.406718Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:51.408176Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:52.409806Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:53.417039Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:54.419167Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:55.420382Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:56.422392Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:54:57.320083Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22)  Source distribution.
2020-12-11T00:54:59.277837Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-11T00:54:59.738791Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2020-12-11T00:55:01.193023Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-11T00:55:01.194637Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-11T00:55:01.586177Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.22'  socket: '/opt/bitnami/mysql/tmp/mysql.sock'  port: 3306  Source distribution.
juan131 commented 3 years ago

Hi @siegfried01

So it looks like the file system is extremely slow. As you can see even without a timeout of 300 seconds it wasn't able to start.. And if you take a look to the logs in the second attempt, it actually needed 14 minutes to start!!.

That's a huge amount of time if we compare it with running the same chart on a cluster in the cloud (such as TKG, GKE, AKS, etc.) where it needs ~30 seconds to start.

Also, the errors like the one below suggest that when MySQL is restarted, the "mysql stop" operation needed a lot of time tu unlock the ibdata1 file, hence the errors until the mysql process could lock it.

2020-12-11T00:53:55.355851Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2020-12-11T00:53:56.356636Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11

This another symptom of the slowness of the filesystem.

I am afraid that the performance is going to be very very poor in your "Docker For Desktop Kubernetes" environment, and I highly recommend you to use another environment to run the chart.

siegfried01 commented 3 years ago

Do you have any idea as to I'm having this problem with Bitnami MySQL and no problem with Bitnami PostreSql?

yelhouti commented 3 years ago

I have been facing a very similar issue, but not exactly the same, downgrading helped, and their is why: https://github.com/bitnami/bitnami-docker-mysql/issues/121 Not sure it will help in your case though, but still putting here for others.

rafariossaa commented 3 years ago

Hi, @siegfried01 the initialization process for mysql and postgresql are different so it is not easy to compare both. Could you try what @yelhouti suggested ?.

stale[bot] commented 3 years ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

stale[bot] commented 3 years ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

gomon3 commented 5 months ago

Hello... it worked for me by assigning more capacity to the pod... in this case, you must assign (at least) the prefix 'small' to primary.resourcesPreset=small

secondary.resourcesPreset=small