我们使用Argo CD前,需要配置一些认证信息。


添加Argo CD REPO

首先需要添加的就是我们可SSH访问Gitlab的私钥。

这些只需要使用到Kubernetes自有的Kind。

apiVersion: v1
data:
  sshPrivateKey: < cat ~/.ssh/id_rsa | base64 >
kind: Secret
metadata:
  annotations:
    managed-by: argocd.argoproj.io
  name: repo-gitlab
  namespace: argocd
type: Opaque

然后编辑argocd-cm,添加仓库信息:

apiVersion: v1
data:
  accounts.ops: apiKey,login
  accounts.ops.enable: "true"
  repositories: |-
    - insecure: true
      insecureIgnoreHostKey: true
      name: gitlab
      sshPrivateKeySecret:
        key: sshPrivateKey
        name: repo-gitlab
      type: git
      url: [email protected]:gitops/argocd.git
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
  name: argocd-cm
  namespace: argocd

我们一次可以添加多个仓库信息。