Skip to content

Latest commit

 

History

History
118 lines (95 loc) · 3.38 KB

File metadata and controls

118 lines (95 loc) · 3.38 KB

argocd 安装

用 GitOps 方式把 Kubernetes 声明式配置“自动、可观测、可回滚”地同步到集群的控制器;它是 Kubernetes 世界里 GitOps 的事实标准。

初始安装

  • 建议使用helm chart 方式基础安装;后续用声明式方式配置cluster、project、repository等

服务暴露

  • 建议使用ingress方式
  • 备用:kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'

密码登录

  • 获取初始化密码 argocd admin initial-password -n argocd
  • 登录 argocd login {nodeIP}:{nodePort}
  • 更新密码 argocd account update-password
  • 重置遗忘密码
kubectl -n argocd patch secret argocd-secret -p '{"data": {"admin.password": null, "admin.passwordMtime": null}}'
kubectl -n argocd delete pods -l app.kubernetes.io/name=argocd-server

SSO 登录

  dex.config: |
    connectors:
    - type: oidc
      id: aliyun
      name: aliyun
      config:
        issuer: https://oauth.aliyun.com
        clientID: "406************"
        clientSecret: E8G***************************************************b6
        scopes:
        - profile
        - openid
        - aliuid
        getUserInfo: true
        userIDKey: uid
        userNameKey: uid
        claimMapping:
          preferred_username: name
          email: uid
  • 配置argocd-rbac-cm
data:
  policy.csv: |
    # 设置普通用户app-dev 只读权限
    p, role:app-dev, projects, get, *, allow
    p, role:app-dev, applications, get, *, allow
    p, role:app-dev, logs, get, *, allow
    p, role:app-dev, exec, create, */*, allow

    # 设置测试项目,所有权限
    p, role:app-dev, applications, *, test-project/*, allow
    
    # 阿里云子账号 ID:2***********84
    g, "2***********84", role:admin
    g, "2***********27", role:app-dev

  policy.default: role:''
  scopes: '[name]'

支持 application in any namespace

  • 配置 argocd-cm
data:
  # 设置argocd 资源标记方式,使用annotation,禁用labelKey
  # application.instanceLabelKey: argocd.argoproj.io/instance
  application.resourceTrackingMethod: annotation
  • 配置 argocd-cmd-params-cm
data:
  #application.namespaces: app-team-one, app-team-two
  application.namespaces: '*'
  applicationsetcontroller.allowed.scm.providers: '*'
  applicationsetcontroller.namespaces: '*'

然后重启 argocd-server 和 argocd-application-controller

其他设置

# 修改argocd-cm configmap,重启argocd-application-controller
data:
  resource.customizations: |
    networking.k8s.io/Ingress:
      health.lua: |
        hs = {}
        hs.status = "Healthy"
        hs.message = "Skip health check for Ingress"
        return hs