16 Jan 2022 argocd使用tips

2023-10-17 10:29:42 浏览数 (2)

  • 添加集群

代码语言:javascript复制
kubectl config get-contexts -o name
argocd cluster add admin --name soli-mc
  • 查看集群
代码语言:javascript复制
argocd cluster list
  • 在argocd中安装applicationset
代码语言:javascript复制
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/applicationset/v0.3.0/manifests/install.yaml
  • 忽略repo中某些文件
代码语言:javascript复制
...
  source:
    path: ignore-files
    repoURL: 'https://github.com/songleo/argocd-demo.git'
    targetRevision: HEAD
    directory:
      recurse: true
      exclude: 'svc.yaml'
...
  • 忽略app生成的resouce
代码语言:javascript复制
...
argocd.argoproj.io/compare-options: IgnoreExtraneous
...
  • 从vault读取数据
代码语言:javascript复制
    avp.kubernetes.io/path: "/path/data/key"
    avp.kubernetes.io/secret-version: "5"
  • 修改argocd cm配置plugin
代码语言:javascript复制
...
data:
  configManagementPlugins: |
    - name: updateReplicas
      init:
        command: [sh, -c, 'sed -i "s/replicas: 2/replicas: 1/" hostname.yaml']
      generate:
        command: [sh, -c, 'cat hostname.yaml']
      lockRepo: true
...
  • 资源同步顺序
代码语言:javascript复制
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "-1"

:) 未完待续……

LEo at 00:12

0 人点赞