无法定位argocd-repo-server服务器:新增仓库连接失败求助
ArgoCD 添加仓库时出现 argocd-repo-server DNS 解析失败错误
错误详情
执行仓库添加操作时,反复触发以下504错误:
rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing failed to do connect handshake, response: \"HTTP/1.1 504 Unknown Host\r\nContent-Length: 666\r\nCache-Control: no-store\r\nContent-Language: en\r\nContent-Type: text/html\r\nDate: Tue, 07 Feb 2023 15:49:56 GMT\r\n\r\n<HEAD><TITLE>Unknown Host</TITLE></HEAD>\n<BODY BGCOLOR=\"white\" FGCOLOR=\"black\"><H1>Unknown Host</H1><HR>\n<FONT FACE=\"Helvetica,Arial\"><B>\nDescription: Unable to locate the server named \"<em>argocd-repo-server</em>\" --- the server does not have a DNS entry. Perhaps there is a misspelling in the server name, or the server no longer exists. Double-check the name and try again.</B></FONT>\n<HR>\n<!-- default \"Unknown Host\" response (504) -->\n</BODY>\n \x00\""
已知现状
- argocd-repo-server已在集群内正常运行且可访问
复现步骤
执行如下命令触发错误:
argocd repo add http://git.example.com/repos/repo --username git --password --insecure-skip-server-verification
所用ArgoCD版本
argocd: v2.5.6+9db2c94 BuildDate: 2023-01-10T19:30:17Z GitCommit: 9db2c9471f6ff599c3f630b446e940d3a065620b GitTreeState: clean GoVersion: go1.18.9 Compiler: gc Platform: linux/amd64 FATA[0000] Argo CD server address unspecified
排查与修复方案
1. 补全ArgoCD CLI的服务器地址配置
版本信息中明确提示Argo CD server address unspecified,说明CLI未指定要连接的ArgoCD服务器。可通过两种方式解决:
- 先执行登录命令配置默认服务器:
argocd login <你的ArgoCD服务器地址> - 或在添加仓库时直接通过
--server参数指定:argocd repo add http://git.example.com/repos/repo --username git --password --insecure-skip-server-verification --server <你的ArgoCD服务器地址>
2. 验证集群内部DNS解析
即使repo-server运行正常,集群DNS可能无法解析其服务名。在集群内任意Pod中执行以下命令验证:
nslookup argocd-repo-server.argocd.svc.cluster.local
(将argocd替换为实际的ArgoCD命名空间)
若解析失败,检查:
- CoreDNS或集群DNS组件是否正常运行
- argocd-repo-server的Service是否正确创建,标签选择器与Pod匹配
3. 检查ArgoCD服务器与repo-server的通信配置
确认argocd-server的配置是否正确指向repo-server的服务地址:
kubectl get configmap argocd-cm -n argocd -o yaml
排查是否存在错误的repo-server地址配置。
4. 排查代理配置
若环境使用代理,可能代理无法解析集群内部域名:
- 确保代理配置排除了集群内部域名后缀(如
.svc.cluster.local) - 检查ArgoCD组件的
NO_PROXY/no_proxy环境变量,确认包含集群内部域名后缀
内容的提问来源于stack exchange,提问作者שלומי גנון
相关产品推荐
相关产品推荐

