行业知识
云原生产品发布工具——ArgoCD
1. argoCD
官���:https://argoproj.github.io/
github 地址:https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd
1. 安装
1. Helm
1. 添加 repo
# 1. 添加[root@localhost argo]# helm repo add argo-cd https://argoproj.github.io/argo-helm# 2. 更新[root@localhost argo]# helm repo update# 3. 查看[root@localhost argo]# helm search repo argo-cd | grep argo-cd/argo-cdNAME CHART VERSION APP VERSION DESCRIPTIONargo-cd/argo-cd 5.52.0 v2.9.3 A Helm chart for Argo CD, a declarative, GitOps...
2. 编辑 values.yaml
根据自己的环境情况,添加、修改适应于自己环境的编排参数
[root@localhost argo]# cat values.yamlserver: ingress: enabled: true annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/ssl-passthrough: "true" # 后端默认启用 https , 如果禁用,同时需要修改: # For the fist option, disable the HTTPS redirect, we will have to add the --insecure flag to server.extraArgs: # server.extraArgs.- --insecure nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" hosts: - argocd-test.local.com http: paths: - backend: serviceName: argocd-server servicePort: 80 path: / tls: - secretName: test-http-cert hosts: - argocd-test.local.com
3. 安装
[root@localhost argo]# helm upgrade --install argocd argo-cd/argo-cd -f values.yaml -n argocdRelease "argocd" does not exist. Installing it now.NAME: argocdLAST DEPLOYED: Mon Aug 23 16:02:30 2021NAMESPACE: argocdSTATUS: deployedREVISION: 1TEST SUITE: None
④、获取密码
[root@localhost ~]# kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d ⑤、登录 web
使用 values.yaml 定义的 ingress 地址进行登录即可:argocd-test.local.com
2. 使用
-
更新 charts version
如果 helm charts 版本发生更新,则需要先点击 helm release --> edit --> 版本。让其自动完成同步;
-
更新服务
点击相应的 chart,如 operation-board-php --> sync --> 选择一个具体的资源进行发布;
- status:
- outofsync: 同步(发布)资源失败;
- Synced:同步(发布)资源成功;
- health:
- degraded:
- Healthy: 正常
- status:
1. create app
Application -> NEW APP
3. 清除缓存
在 chart 编排(包括values文件)发生变化但版本号不变的情况下,argocd 不会拉取新的编排。这时需要执行以下步骤来删除缓存
1. 删除 server 记录
[root@localhost ~]# kubectl -n argocd exec -it argocd-repo-server-name sh$ cd /tmp && ls$ cd helmxxxx && ls$ cd ../https_xxxx & ls$ rm -f helm-charts-name
2. 删除 redis 记录
[root@localhost ~]# kubectl -n argocd exec -it argocd-redis-ha-server-xx sh/data $ redis-cli127.0.0.1:6379> keys *helm-charts-name | version-num127.0.0.1:6379> del *helm-charts-name | version-num [key ...]
3. 重新同步
执行 argocd sync 进行同步
4. 设置
1. add helm repo
Settings -> Repositories -> Connect Repo using HTTPS and submit below details
Type : helm
Name : repo 名字
Repository URL : repo 地址
非制品库域名,是具体 repo 如: https://harbor.hai.io/chartrepo/test
2. create project
Settings -> Projects -> NEW PROJECT
5. 客户端
1. 安装
Argo CD Git 仓库发布页面 或 使用命令获取最新版本
[root@localhost ~]# VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*//')
VERSION 在下面的命令中替换为你要下载的 Argo CD 版本:
[root@localhost ~]# curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
添加执行权限
[root@localhost ~]# chmod +x /usr/local/bin/argocd
2. 服务端管理
指令集
格式:
- argocd [flags]
1. 登录
格式:
- argocd login SERVER [flags]
1. username & password
Login to Argo CD using a username and password
# 不使用 --grpc-web[root@localhost ~]# argocd login argocd-test.hai.comWARN[0000] Failed to invoke grpc call. Use flag --grpc-web
上一篇:云游戏电脑挂机脚本教程
下一篇:squad服务器如何选择?