helm安装argocd
下载chart
helm repo add argo https://argoproj.github.io/argo-helm
helm pull argo/argo-cd编写values.yaml
redis-ha:
enabled: true
controller:
enableStatefulSet: true
server:
replicas: 2
env:
- name: ARGOCD_API_SERVER_REPLICAS
value: '2'
ingress:
enabled: false
https: false
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
ingressClassName: nginx
hosts:
- argocd-server.example.com
tls:
- hosts:
- argocd-server.example.com
secretName: example-com-tls
certificate:
enabled: false
repoServer:
replicas: 2
config:
# Argo CD's externally facing base URL (optional). Required when configuring SSO
url: https://argocd-server.example.com
# Argo CD instance label key
application.instanceLabelKey: argocd.argoproj.io/instance
# keycloak sso
oidc.config: |
name: Keycloak
issuer: https://sso.example.com/auth/realms/oc
clientID: argocd
clientSecret: $oidc.keycloak.clientSecret
requestedScopes: ["openid", "profile", "email", "groups"]执行安装
安装argocd cli
配置keycloak sso
keycloak 添加client ,配置ArgoCD用户组
略
参考:https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/keycloak/
编辑argocd-cm
如下所示:
注意:如果使用 helm upgrade 更新argocd 服务, 需要重新修改 argocd-cm
配置ArgoCD权限策略
keycloak中 /ArgoCDAdmins 组用户默认admin角色,如下所示:
注意:组名ArgoCDAdmins前面必须有/, 否则不能匹配
添加集群
使用argocd cli 登录 argocd
添加rancher 集群
rancher 管理的K8s 集群,不能直接使用argocd cli添加到clusters, argocd clusters 实际是与k8s crd 交互 ,所以我们手动添加k8s secret ,会自动添加到 argocd clusters 中
创建cicd用户并创建 apikey,指定集群范围
略
编写k8s-test-argocd-secret,apikey 显示值填写到下面yaml 内容中
使用argocd cli 查看clusters 列表
显示如下
添加 gitlab webhook
Argo CD每三分钟轮询一次Git存储库,以检测清单的更改。为了消除轮询的延迟,API服务器可以被配置为接收webhook事件。Argo CD支持GitHub, GitLab, Bitbucket, Bitbucket Server和Gogs的Git webhook通知。
添加webhook secret
编辑 argocd-secret
在 data 中添加 webhook.github.secret,值需要使用base64编码
helm chart 项目添加webhook
**Chart 项目 --> 设置->集成 **
URL 输入
Secret Token 输入
选择Trigger
Tag push events 、Push events
点击 Add webhhok
参考
https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd
https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/keycloak/
https://docs.openshift.com/container-platform/4.7/cicd/gitops/configuring-sso-for-argo-cd-on-openshift.html
https://argo-cd.readthedocs.io/en/stable/operator-manual/webhook/
https://www.cnblogs.com/novwind/p/15358792.html
https://gist.github.com/janeczku/b16154194f7f03f772645303af8e9f80
Last updated