Mysql Kubernetes 部署舵图失败,准备就绪,活性探测失败

时间:2021-06-09 13:35:56

标签: mysql kubernetes kubernetes-helm readinessprobe livenessprobe

我是 stackoverflow 的新手,所以如果我没有遵守提出这个问题的所有规则,请原谅。

所以,我使用这个舵图:https://github.com/helm/charts/tree/master/stable/mysql 为我们的生产环境部署 mysql。事实上,我们在生产中运行了这个设置,但它只创建了 1 个 mysql pod,而我需要运行 3 个 pod。我尝试在 helm 图表的 values.yaml 文件中设置 replicas=3 并重新部署该图表,但它不断失败并出现一些错误,错误是:

Events:
    Type     Reason            Age                    From                  Message
    ----     ------            ----                   ----                  -------
    Warning  FailedScheduling  4m58s                  default-scheduler     pod has unbound immediate PersistentVolumeClaims (repeated 4 times)
    Normal   Scheduled         4m58s                  default-scheduler     Successfully assigned test-helm/cluster-mysql-5bcdf87779-vdb2s to innolx12896
    Normal   Pulled            4m57s                  kubelet, innolx12896  Container image "busybox:1.29.3" already present on machine
    Normal   Created           4m56s                  kubelet, innolx12896  Created container
    Normal   Started           4m56s                  kubelet, innolx12896  Started container
    Warning  BackOff           4m32s (x2 over 4m37s)  kubelet, innolx12896  Back-off restarting failed container
    Normal   Pulled            2m52s (x4 over 4m55s)  kubelet, innolx12896  Container image "mysql:5.7.14" already present on machine
    Normal   Created           2m52s (x4 over 4m55s)  kubelet, innolx12896  Created container
    Warning  Unhealthy         2m52s (x3 over 3m12s)  kubelet, innolx12896  Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
                                                                            mysqladmin: connect to server at 'localhost' failed
                                                                            error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
                                                                            Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
    Normal   Killing           2m52s                  kubelet, innolx12896  Killing container with id docker://cluster-mysql:Container failed liveness probe.. Container will be killed and recreated.
    Normal   Started           2m51s (x4 over 4m54s)  kubelet, innolx12896  Started container
    Warning  Unhealthy         2m12s (x4 over 3m42s)  kubelet, innolx12896  Liveness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
                                                                            mysqladmin: connect to server at 'localhost' failed
                                                                            error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
                                                                            Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

此外,当我尝试查看 mysqld 袜子时,它也不见了。但我不明白为什么。由于单个 pod 部署工作正常,但 3 个 pod 部署会产生此错误。

也可能有办法通过明确定义其他 StackOverflow 答案建议的袜子路径来解决这个问题1 或这个答案2。但需要注意的是,我们通过 Jenkins 实现了整个生产图表部署的自动化,并且没有为每个生产版本明确运行这些命令的范围。

所以,我需要知道如何解决这个问题,或者可能知道是什么导致了这个问题,以便我可以更改或更改我在开头提到的 helm chart 中的一些参数。还请告诉我是否无法扩展此部署,这意味着此掌舵图不支持或不适用于多个 mysql pod。

提前致谢。

0 个答案:

没有答案