You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

将ArgoCD连接至不安全Nexus Registry的问题求助

解决ArgoCD访问HTTP Nexus镜像仓库的问题

一、修复HTTP仓库格式错误

添加HTTP类型镜像仓库时,需严格遵循正确格式:

  • 使用ArgoCD CLI添加的完整命令示例:
    argocd repo add http://nexus.your-domain.com:8081/repository/docker-hosted/ --type docker --insecure-skip-server-verification
    
    注意:必须指定--type docker,URL需填写Nexus中Docker仓库的完整路径,不能在镜像名前随意拼接HTTP前缀。
  • 通过Kubernetes资源定义添加时,spec.url字段直接填写HTTP开头的完整仓库地址,示例:
    apiVersion: argoproj.io/v1alpha1
    kind: Repository
    metadata:
      name: nexus-docker-repo
      namespace: argocd
    spec:
      type: docker
      url: http://nexus.your-domain.com:8081/repository/docker-hosted/
      insecure: true
    

二、解决"invalid session: signature is invalid"认证错误

该错误与仓库不安全验证设置无关,是ArgoCD CLI会话过期或无效导致的:

  • 执行重新登录命令,确保会话有效:
    argocd login <your-argocd-server-address> --insecure  # 若ArgoCD本身使用HTTP访问
    
    登录完成后再尝试添加仓库操作。

三、全局或带认证的灵活配置方式

如果需要批量允许不安全仓库,可修改ArgoCD全局配置:

  1. 编辑argocd-cm ConfigMap:
    kubectl edit configmap argocd-cm -n argocd
    
  2. 添加或修改repository.allowInsecure字段为"true":
    data:
      repository.allowInsecure: "true"
    
  3. 重启ArgoCD的repo-server组件使配置生效:
    kubectl rollout restart deployment argocd-repo-server -n argocd
    

若Nexus仓库需要认证,可通过Kubernetes Secret存储凭证后在ArgoCD中引用:

  • 创建config.json文件,内容示例:
    {
      "auths": {
        "http://nexus.your-domain.com:8081": {
          "username": "admin",
          "password": "your-nexus-password",
          "auth": "YWRtaW46eW91ci1uZXh1cy1wYXNzd29yZA=="  # 用户名密码的base64编码结果
        }
      }
    }
    
  • 创建Secret:
    kubectl create secret docker-registry nexus-repo-secret --from-file=.dockerconfigjson=./config.json -n argocd
    
  • 在ArgoCD仓库配置中引用该Secret:
    apiVersion: argoproj.io/v1alpha1
    kind: Repository
    metadata:
      name: nexus-docker-repo
      namespace: argocd
    spec:
      type: docker
      url: http://nexus.your-domain.com:8081/repository/docker-hosted/
      insecure: true
      secret:
        name: nexus-repo-secret
    

内容的提问来源于stack exchange,提问作者sfl0r3nz05

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 13:18:15