ArgoCD 无法与“请求 SSH 代理但未指定 SSH_AUTH_SOCK”同步

lar*_*sks 6 git ssh kubernetes gitops argocd

我们已经愉快地将 ArgoCD 与公共存储库一起使用了一段时间,但在尝试将 ArgoCD 连接到私有存储库时遇到了问题。我们有一个Application看起来像这样的:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: example-app
  namespace: argocd
spec:
  destination:
    name: example-cluster
    namespace: open-cluster-management-agent
  project: ops
  source:
    path: .
    repoURL: ssh://git@github.com/example-org/example-repo.git
    targetRevision: HEAD
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
    - Validate=false
    - ApplyOutOfSyncOnly=true
Run Code Online (Sandbox Code Playgroud)

以及相应的密钥,其密钥如下所示:

apiVersion: v1
metadata:
  labels:
    argocd.argoproj.io/secret-type: repository
  name: example-repo
  namespace: argocd
type: Opaque
stringData:
  sshPrivateKey: |
    -----BEGIN OPENSSH PRIVATE KEY-----
    ...
    -----END OPENSSH PRIVATE KEY-----
  url: ssh://git@github.com/example-org/example-repo.git
kind: Secret
Run Code Online (Sandbox Code Playgroud)

ArgoCD 无法同步此应用程序并显示以下错误:

rpc error: code = Unknown desc = error creating SSH agent: "SSH agent
requested but SSH_AUTH_SOCK not-specified"
Run Code Online (Sandbox Code Playgroud)

我明白这告诉我什么,但我不确定如何在 ArgoCD 的背景下纠正这个问题。

Von*_*onC 3

您可以查看问题 1172中的可能原因argoproj/argo-cd

由于您有正确的 URL(ssh://git@github.com/...,按照PR 203 的要求),请仔细检查缩进:

这是我引起的识别问题:)导致repositories.yaml错误的解组和空的sshPrivateKeySecret.
正确的版本在这里:

- sshPrivateKeySecret:
   key: sshPrivateKey
   name: bitbucket
 url: git@bitbucket.org:MY-PROJECT/MY-REPO
Run Code Online (Sandbox Code Playgroud)