Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Ability to add an initContainer for the MySQL StatefulSet #194

Open
cicdguy opened this issue Oct 24, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@cicdguy
Copy link

cicdguy commented Oct 24, 2023

I am unable to run the MySQL database on the k8s cluster as the mysql user wherein I set the securityContext to runAsUser with ID 999, as available in the mysql:8 image. Running as root is not an option either, due to security concerns.

This is the log:

2023-10-24 19:36:31+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
2023-10-24 19:36:31+00:00 [Note] [Entrypoint]: Initializing database files
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied)
2023-10-24T19:36:31.447303Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.27) initializing of server in progress as process 22
2023-10-24T19:36:31.448251Z 0 [ERROR] [MY-010460] [Server] --initialize specified but the data directory exists and is not writable. Aborting.
2023-10-24T19:36:31.448255Z 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.
2023-10-24T19:36:31.448284Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-10-24T19:36:31.448376Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete

In order to circumvent this, I need to have an initContainer where I can override the file permissions on /var/lib/mysql to chmod it recursively with 999:999 permissions.

This is a request to add the ability to instantiate a new initContainer for the MySQL DB StatefulSet.

@JorgeGar
Copy link
Contributor

I am unable to run the MySQL database on the k8s cluster as the mysql user wherein I set the securityContext to runAsUser with ID 999, as available in the mysql:8 image. Running as root is not an option either, due to security concerns.

This is the log:

2023-10-24 19:36:31+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
2023-10-24 19:36:31+00:00 [Note] [Entrypoint]: Initializing database files
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied)
2023-10-24T19:36:31.447303Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.27) initializing of server in progress as process 22
2023-10-24T19:36:31.448251Z 0 [ERROR] [MY-010460] [Server] --initialize specified but the data directory exists and is not writable. Aborting.
2023-10-24T19:36:31.448255Z 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.
2023-10-24T19:36:31.448284Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-10-24T19:36:31.448376Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete

In order to circumvent this, I need to have an initContainer where I can override the file permissions on /var/lib/mysql to chmod it recursively with 999:999 permissions.

This is a request to add the ability to instantiate a new initContainer for the MySQL DB StatefulSet.

Hi @cicdguy am I correct assuming that user 999 is mysql user? If so, it seems that’s an issue to report on MySQL’s image.
In any case, adding the ability to create an initContainer could be nice. I encourage you to open a pull request adding it to the helm chart.

@ProjectsOfMLee
Copy link
Contributor

@JorgeGar Can you assign me to fix it? Facing the same issue.

@JorgeGar JorgeGar added the enhancement New feature or request label Oct 25, 2023
@JorgeGar
Copy link
Contributor

@JorgeGar Can you assign me to fix it? Facing the same issue.

@ProjectsOfMLee Assigned. Please tag me on the PR too so I can take a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants