Mysql pod restart continuously - InnoDB: Unable to lock ./ibdata1, error: 11

Hi there,
I’m doing some experiment with MicroK8s on both Ubuntu and Centos systems.
Using MicroK8s version 1.8.9, on both machines I’ve also installed Docker CE 19. Docker daemon is up and running.

I’ve tried to create a deployment following exactly the example described here:

When i create the deployment everything goes right - i can access MySql instance without any issue; when I reboot the Centos machine, I noticed that MicroK8s kills and restarts MySql container continuously until the pod is set to crashloopbackoff state. The main reason I can see in the logs is reported in the subject of this post, i.e InnoDB: Unable to lock ./ibdata1, error: 11.

I can’t really what I’m missing or what’s wrong - the deployment.yaml is the same, and on Ubuntu machine this issue doesn’t occur.
Any hint or clue ?
Thanks in advance !

This issue is mostly related to an existing mysql instance already holding the file and another one tries to use it.

Dont know much about your setup, you mean you have 2 independent machines, one is running centos and the other is on ubuntu.

The sample provided is based on hostpath. Im taking a wild guess here, do these machines share host path?

Thanks for your reply.No, the two machines are totally separated, they don’t share anything. I’m also absolutely sure that on the centos host no other MySQL instance is running. I noticed that on Ubuntu Linux the folder I use as persistent storage is owned by ‘docker’, while on centos is owned by root. On my Ubuntu box, docker was already installed when I installed microk8s, but I don’t this could be the reason of the problem I am experiencing.

Im guessing here. When you rebooted your machine, did you gracefully stopped MicroK8s?

Im thinking that the data file is/was corrupted.

No, I brutally issued a “reboot”, just willing to simulate what happens if I need to shutdown forcibly the VM hosting MicroK8s.
By the way, the same microk8s instance handles a Postgres deployment, which doesn’t present this problem - this makes me confident that the reason for this misbehaviour could be related to MySql itself.
I would try your guess, i.e to shutdown microk8s before rebooting, even if I don’t think data files are corrupted - if I redeploy MySql, I can see tables and schemas created with the previous deployment.
Thanks so much for your help !!

Tried same deployment on a fresh-installed Ubuntu 20.04 server, no problem at all. Since my main goal is to investigate K8s, and Ubuntu + microk8s play very well together, I think I’ll go on with this stack at the moment.
Thank you, balchua1, for your answers and help !