Helm servecm插件安装失败,请求排查调试方案
问题背景
使用install_helm.sh脚本安装Helm的servecm插件时失败,此前该脚本在其他机器可正常运行。当前现象为脚本持续循环提示servecm not yet running. sleeping for 2 seconds,nohup日志显示安装ChartMuseum时出现S3访问拒绝错误,curl命令解析主机失败。
脚本内容
echo "Installing servecm (Chart Manager) and common templates to helm3" helm plugin install https://github.com/jdolitsky/helm-servecm eval $(helm env |grep HELM_REPOSITORY_CACHE) echo ${HELM_REPOSITORY_CACHE} nohup helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ <<EOF & yes EOF CURL_CMD="curl --silent --output /dev/null http://127.0.0.1:8879/charts" `${CURL_CMD}` READY=$? while [ ${READY} != 0 ]; do echo "servecm not yet running. sleeping for 2 seconds" sleep 2 `${CURL_CMD}` READY=$? done
nohup日志错误信息
ChartMuseum not installed. Install latest stable release? (type "yes"): Attempting to install ChartMuseum server (<?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>AJSFRBH3EY2MFNDJ</RequestId><HostId>xjT8lkHaQIVUlmXOQJTTCGT+3vRA/YfvYwYzdTJM9ppLWUKcbf9qu9c07Ow0dbYDxDTUUSI2yTA=</HostId></Error>)... Detected your os as "linux" + curl -LO 'https://s3.amazonaws.com/chartmuseum/release/<?xml' 'version="1.0"' 'encoding="UTF-8"?>' '<Error><Code>AccessDenied</Code><Message>Access' 'Denied</Message><RequestId>AJSFRBH3EY2MFNDJ</RequestId><HostId>xjT8lkHaQIVUlmXOQJTTCGT+3vRA/YfvYwYzdTJM9ppLWUKcbf9qu9c07Ow0dbYDxDTUUSI2yTA=</HostId></Error>/bin/linux/amd64/chartmuseum' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 243 0 243 0 0 250 0 --:--:-- --:--:-- --:--:-- 250 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: version="1.0" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: encoding="UTF-8" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: <Error><Code>AccessDenied< % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: Denied< + rm -rf /tmp/tmp.OzCIXcXSxl Error: plugin "servecm" exited with error
环境变量HELM_REPOSITORY_CACHE值
root@Ubuntu-20:/home/ravi/ric-dep/bin# helm env |grep HELM_REPOSITORY_CACHE HELM_REPOSITORY_CACHE="/root/.cache/helm/repository" root@Ubuntu-20:/home/ravi/ric-dep/bin#
错误分析
从日志可见,servecm插件自动安装ChartMuseum时,请求S3存储的资源返回AccessDenied错误,插件错误地将XML格式的错误信息当作版本号拼接进下载URL,导致curl把URL拆分成多个无效主机名,最终解析失败,ChartMuseum未安装成功,进而servecm无法启动,触发脚本的循环检测。
调试排查步骤
1. 手动安装ChartMuseum绕过自动下载
- 直接获取对应系统的ChartMuseum二进制包(比如Linux amd64版本)
- 将二进制文件放到系统PATH目录(如
/usr/local/bin),赋予执行权限:chmod +x /usr/local/bin/chartmuseum - 验证安装:
chartmuseum --version
2. 检查网络访问权限
- 测试当前机器能否访问S3的ChartMuseum存储路径:
curl -v https://s3.amazonaws.com/chartmuseum/release/stable.txt- 若返回403 AccessDenied,说明机器网络受限(防火墙、代理、AWS区域限制等),需调整网络策略,或改用手动下载方式
- 检查代理配置:执行
echo $http_proxy $https_proxy,若网络需要代理但未配置,先设置代理环境变量
3. 修复脚本的自动交互逻辑
原脚本用here-doc传递yes可能存在交互接收问题,改用管道传递输入:
# 替换原nohup启动命令 nohup yes | helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ &
4. 验证servecm启动状态
- 手动执行启动命令,查看实时输出:
yes | helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ - 检查进程是否存在:
ps aux | grep chartmuseum - 检查端口监听情况:
ss -tulpn | grep 8879
5. 重新安装servecm插件
- 查看已安装插件:
helm plugin list - 卸载后重装:
helm plugin uninstall servecm helm plugin install https://github.com/jdolitsky/helm-servecm
6. 确认存储目录权限
- 创建并设置存储目录权限:
mkdir -p $HELM_REPOSITORY_CACHE/local/ chmod -R 755 $HELM_REPOSITORY_CACHE/local/
内容的提问来源于stack exchange,提问作者myquest5 sh
相关产品推荐
相关产品推荐

