Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Mysql container crash when deploying on GKE #59

@idkw

Description

@idkw

Hi,

I'm trying to deploy this image with the following kubernetes files :

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mysql-data
  annotations:
    volume.alpha.kubernetes.io/storage-class: ssd
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 50Gi
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels:
    name: mysql
spec:
  hostname: mysql
  containers:
    - image: launcher.gcr.io/google/mysql8
      name: mysql
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: test
        - name: MYSQL_DATABASE
          value: test
        - name: MYSQL_USER
          value: test
        - name: MYSQL_PASSWORD
          value: test

      volumeMounts:
        - name: mysql-data
          mountPath: /var/lib/mysql
  volumes:
    - name: mysql-data
      persistentVolumeClaim:
        claimName: mysql-data

When the container is deployed, the mysql server starts and then crash immediately.
The logs are :

Initializing database
2019-11-28T16:39:29.865253Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2019-11-28T16:39:29.865292Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-11-28T16:39:29.865519Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.18) initializing of server in progress as process 34
2019-11-28T16:39:29.867317Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-11-28T16:39:29.867329Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2019-11-28T16:39:29.867455Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-28T16:39:29.869476Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

I see that it crashes with :

2019-11-28T16:39:29.867329Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.

I haven't found any relevant solution to this issue.
When launching the container locally on my machine I don't get that issue.
Is there some kind of file permission issue on GCP persistent volumes claims ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions