ArgoCD Private Repo Declarative Approach

11/2/2021

I am trying to deploy the sample Guestbook Helm Application with ArgoCD, using a private repo with SSH. I am getting the below error.

Error

rpc error: code = Unknown desc = error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"

I've tried both URL formats with:

git@github.com:myOrg/myrepo.git 

and

ssh://git@github.com/myOrg/myrepo.git

Neither work and both produce the same error. When I login to the GUI and configure the repo manually, copy and paste my private key that works, but when deploying with the YAML below, it doesn't

Application.yaml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: helm-guestbook
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: helm-guestbook
    server: {{ .Values.spec.destination.server }}
  project: default
  source:
    path: helm-guestbook
    repoURL: {{ .Values.spec.source.repoURL }}
    targetRevision: {{ .Values.spec.source.targetRevision }}

Values.yaml

spec:
  destination:
    server: https://kubernetes.default.svc
  source:
    repoURL: git@github.com:myOrg/myrepo.git
    targetRevision: HEAD

RepoCreds.yaml

apiVersion: v1
kind: Secret
metadata:
  name: private-repo
  namespace: argocd
  labels:
    argocd.argoproj.io/secret-type: repository
stringData:
  url: {{ .Values.spec.source.repoURL }}
  sshPrivateKey: |
    -----BEGIN OPENSSH PRIVATE KEY-----
    ...
 
    -----END OPENSSH PRIVATE KEY-----
-- CodyK
argocd
github
kubernetes
kubernetes-helm
ssh

1 Answer

11/2/2021

Turned out to be a version mismatch. I was using the ArgoCD Operator to install ArgoCD. I was using the latest ArgoCD Operator version (v.0.0.15). By default it was pulling an earlier version of Argo. I updated the ArgoCD resource to specify the latest ArgoCD version image tag (v2.1.6).

-- CodyK
Source: StackOverflow