I have a sidecar container in a MySQL Pod which will use the MySQL socket file in order to access the database.
I would like to be sure MySQL has successfully started and therefore have created the socket file before than this sidecar container starts.
I tried to add a readiness
probe with an exec.command
being test -S /var/run/mysqld/mysqld.sock
but it fails with:
Readiness probe failed: OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "test -S /var/run/mysqld/mysqld.sock": stat test -S /var/run/mysqld/mysqld.sock: no such file or directory: unknown
When I open a terminal session in the sidecar container, I can ls
the socket file and it's there.
So it looks like my test -S <path>
command doesn't work as expected in the context of the probe.
How can I write my probe so that as soon as the socket file is available my sidecar container starts?
Try:
...
readinessProbe:
exec:
command:
- sh
- -c
- test -S /var/run/mysqld/mysqld.sock