gpt4 book ai didi

Mysql Kubernetes Deployment helm chart 因准备就绪和事件探测失败而失败

转载 作者:行者123 更新时间:2023-12-05 03:41:00 25 4
gpt4 key购买 nike

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

所以,我正在使用这个 Helm chart :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 socks 时,它不见了。但我不明白为什么。由于单个 pod 部署工作正常,但 3 个 pod 部署会产生此错误。

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

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

提前致谢。

最佳答案

在您的案例中,Readiness 探测似乎失败了,Liveness 探测失败了。对于 MySQL,请尝试使用以下内容(在 templates/deployment.yaml 中)来了解 Readiness & Liveness:

ports:
- name: mysql
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
exec:
command: ["mysqladmin", "ping"]
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
exec:
# Check we can execute queries over TCP (skip-networking is off).
command: ["mysql", "-h", "127.0.0.1", "-e", "SELECT 1"]
initialDelaySeconds: 5
periodSeconds: 2
timeoutSeconds: 1

关于Mysql Kubernetes Deployment helm chart 因准备就绪和事件探测失败而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67905245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com