MacOS下Rancher Desktop部署Bitnami MySQL Helm Chart Pod启动失败
MacOS + Rancher Desktop环境下Bitnami MySQL Helm安装失败
问题复现步骤
- 本地环境为MacOS,使用Rancher Desktop
- 采用默认配置
- 执行命令:
helm install my-release bitnami/mysql - Pod启动失败,处于CrashLoopBackOff状态
错误信息
% kubectl get pods NAME READY STATUS RESTARTS AGE my-release-mysql-0 0/1 CrashLoopBackOff 6 (3m12s ago) 8m57s
% kubectl logs my-release-mysql-0 /usr/lib: './var/cache/ldconfig': Permission denied /usr/lib: './proc/tty/driver': Permission denied /usr/lib: './root': Permission denied /usr/lib: './etc/ssl/private': Permission denied mysql Wed Aug 24 23:07:43 UTC 2022INFO ==> ** Starting MySQL ** 2022-08-24T23:07:43.299737Z 0 [Warning] [MY-010939] [Server] Failed to get absolute path of program executable --defaults-file=/opt/bitnami/mysql/conf/my.cnf 2022-08-24T23:07:43.933997Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead. 2022-08-24T23:07:43.934191Z 0 [System] [MY-010116] [Server] --defaults-file=/opt/bitnami/mysql/conf/my.cnf (mysqld 8.0.30) starting as process 1 2022-08-24T23:07:43.953718Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. 2022-08-24T23:07:43.954132Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead. 2022-08-24T23:07:43.956530Z 0 [Warning] [MY-010091] [Server] Can't create test file /bitnami/mysql/data/mysqld_tmp_file_case_insensitive_test.lower-test 2022-08-24T23:07:43.956655Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /bitnami/mysql/data/ is case insensitive 2022-08-24T23:07:43.957378Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to '/bitnami/mysql/data/' (OS errno: 2 - No such file or directory) 2022-08-24T23:07:43.958983Z 0 [ERROR] [MY-010119] [Server] Aborting 2022-08-24T23:07:43.962276Z 0 [System] [MY-010910] [Server] --defaults-file=/opt/bitnami/mysql/conf/my.cnf: Shutdown complete (mysqld 8.0.30) Source distribution.
注意:相同操作在Ubuntu 20.04机器上可正常运行。
解决方案
方法1:调整Rancher Desktop存储驱动
- 打开Rancher Desktop设置界面,切换到「Virtual Machine」标签页
- 将存储驱动从默认的
virtiofs改为overlay - 重启Rancher Desktop生效
- 清理现有失败的部署和存储卷:
helm uninstall my-release kubectl delete pvc data-my-release-mysql-0 - 重新执行安装命令:
helm install my-release bitnami/mysql
方法2:禁用安全上下文约束(临时应急方案)
如果无法调整存储驱动,可在安装时禁用容器的安全上下文限制:
helm install my-release bitnami/mysql --set securityContext.enabled=false --set containerSecurityContext.enabled=false
核心原因:MacOS上Rancher Desktop默认的virtiofs存储驱动在处理容器内目录权限和文件创建时存在兼容性问题,切换为overlay驱动可解决这类文件系统相关的权限、目录不存在错误。
内容的提问来源于stack exchange,提问作者Jerrod Horton
相关产品推荐
相关产品推荐

