Page MenuHomePhabricator

Kubernetes containers do not include /usr/bin/mysql
Closed, DeclinedPublic

Description

I have a CGI (Bash) script in a tool account's public_html on Toolforge which is supposed to run a fixed MySQL query on the database replica and output its result. I am convinced it used to work before, but now it's broken because /usr/bin/mysql is not available to the webservice at all.

Event Timeline

@Blahma Which backend are you using to run your webservice? I think the issue here is that you have legacy code which is expecting to run on the job grid which has a very broad set of software installed. When running on the Kubernetes backend your webservice is hosted inside a Docker container which has a very narrow set of installed software. The php5.6, php7.2, and php7.3 runtimes for the Kubernetes backend do include mariadb libraries and their PHP bindings, but they do not include cli tools like /usr/bin/mysql.

The fix is either to update your tool to use PHP to query the database, or to run your tool on the grid engine rather than on Kubernetes. The first option is a bit more work, but recommended as the grid engine backend is not as robust for keeping webservices running as Kubernetes is.

bd808 renamed this task from Missing /usr/bin binaries in webservices, including /usr/bin/mysql to Kubernetes containers do not include /usr/bin/mysql.Jan 1 2020, 6:44 PM
bd808 triaged this task as Low priority.
bd808 edited projects, added Toolforge; removed cloud-services-team.

@bd808: Hello, thank you for investigating this. I didn't mean to create anything fancy – just an HTTP gateway to executed a fixed SQL query on the database replica and obtain its results.

That's why I chose Bash and CGI (as mentioned in the original post) because that means just a few lines of code in a .sh file. If that is not supported, that should probably be documented somewhere and I should think of replacing it with a PHP script, although I consider that an overkill for such a simple task as dumping the results of a database query.

taavi subscribed.

In most cases I would recommend using a native mariadb client for the programming language used, and if that's not viable a custom image can be built instead. I don't think the client binary should be included in the shared base images.