首页 > 其他分享 >ArgoCD和Argo Rollouts自动化部署应用

ArgoCD和Argo Rollouts自动化部署应用

时间:2023-12-26 18:07:06浏览次数:29  
标签:git Rollouts ArgoCD 192.168 nginx 174.108 ssh Argo 35022

环境说明

使用Argo Rollouts部署nginx应用:
1. 使用Rollout部署nginx
2. 采用canary部署策略
3. 结合Analysis进行渐进式交付
4. 结合Istio VirtualService进行自动化流量分割和流量迁移
5. 部署清单放在git repo中
使用ArgoCD进行自动化部署:
1. 使用Application监视Git Repository
2. 自动在Repository和Destination之间进行同步

Git Repo 说明

git repo地址:
HTTP: http://192.168.174.108:8080/admin/projects/root/nginx-deployment.git
SSH:  ssh://[email protected]:35022/root/nginx-deployment.git

添加私有Git Repo

Argo CD CLI 添加 known_hosts

# ssh-keyscan -p35022 192.168.174.108 | argocd cert add-ssh --batch
# 192.168.174.108:35022 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
Enter SSH known hosts entries, one per line. Press CTRL-D when finished.
# 192.168.174.108:35022 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
# 192.168.174.108:35022 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
# 192.168.174.108:35022 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
# 192.168.174.108:35022 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
Successfully created 3 SSH known host entries

Argo CD CLI 添加私有仓库

# argocd repo add ssh://[email protected]:35022/root/nginx-deployment.git --ssh-private-key-path /root/.ssh/id_rsa
Repository 'ssh://[email protected]:35022/root/nginx-deployment.git' added

查看 repo

# argocd repo list
TYPE  NAME  REPO                                                       INSECURE  OCI    LFS    CREDS  STATUS      MESSAGE  PROJECT
git         ssh://[email protected]:35022/root/nginx-deployment.git  false     false  false  false  Successful

ArgoCD 自动部署应用

application-nginx.yaml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: nginx
  namespace: argocd
  finalizers:                       
    - resources-finalizer.argocd.argoproj.io
  annotations:
    notifications.argoproj.io/subscribe.on-deployed.email: [email protected];[email protected]
spec:
  project: default
  source:
    repoURL: ssh://[email protected]:35022/root/nginx-deployment.git
    targetRevision: HEAD
    path: nginx/prod
  destination:
    server: https://kubernetes.default.svc
    namespace: argo-demo
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      allowEmpty: false
    syncOptions:
    - Validate=false
    - CreateNamespace=true
    - PrunePropagationPolicy=foreground
    - PruneLast=true
    - ApplyOutOfSyncOnly=true
    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m
  ignoreDifferences:
  - group: networking.istio.io
    kind: VirtualService
    jsonPointers:
    - /spec/http/0

创建应用

# kubectl apply -f application-nginx.yaml
application.argoproj.io/nginx created

查看应用

ArgoCD和Argo Rollouts自动化部署应用_Ubuntu

ArgoCD和Argo Rollouts自动化部署应用_nginx_02

访问应用

/ $ while true;do curl nginx.argo-demo.svc.wgs.local -I ; sleep 1;done
HTTP/1.1 200 OK
server: envoy
date: Tue, 19 Dec 2023 07:48:55 GMT
content-type: text/html
content-length: 615
last-modified: Tue, 11 Apr 2023 17:21:57 GMT
etag: "64359735-267"
accept-ranges: bytes
x-envoy-upstream-service-time: 10

更新应用版本

# sed -i 's@nginx:1.24-alpine@nginx:1.25-alpine@g' nginx/prod/Rollout.yaml
# git add .
# git commit -m "update nginx:1.24-alpine to nginx:1.25-alpine"
# git push

查看更新过程

ArgoCD和Argo Rollouts自动化部署应用_git_03

ArgoCD和Argo Rollouts自动化部署应用_Ubuntu_04

ArgoCD和Argo Rollouts自动化部署应用_Ubuntu_05

ArgoCD和Argo Rollouts自动化部署应用_git_06

ArgoCD和Argo Rollouts自动化部署应用_Ubuntu_07



标签:git,Rollouts,ArgoCD,192.168,nginx,174.108,ssh,Argo,35022
From: https://blog.51cto.com/wangguishe/8985884

相关文章

  • ArgoCD 添加私有仓库
    HTTPS方式访问私有仓库ArgoCDCLI添加私有仓库#argocdrepoaddhttps://github.com/argoproj/argocd-example-apps--username<username>--password<password>dashboard添加私有仓库SSHPrivateKeyCredentialArgoCDCLI添加known_hosts#ssh-keyscan-p35022192.168......
  • Argo Rollouts TrafficRouting结合Istio进行Canary流量管理基础
    ArgoRolloutsTrafficRouting概述流量治理技术实现如下:1.按百分比进行流量管理(即5%的流量应流向新版本,其余流量流向稳定版本)2.基于标头的路由(即将带有特定标头的请求发送到新版本)3.镜像流量,其中所有流量都被复制并并行发送到新版本(但响应被忽略)TrafficRouting配置apiVersi......
  • Argo Rollouts notifications
    ArgoRolloutsnotificationscm模板argo-rollouts-notification-configmap的configmap需要部署在argo-rollouts名称空间下。apiVersion:v1kind:ConfigMapmetadata:name:argo-rollouts-notification-configmapdata:template.analysis-run-error:|message:Rollo......
  • Argo Rollouts Canary结合Istio进行流量迁移实例
    环境说明用argorollouts金丝雀发布策略更新nginx服务。发布过程结合Isito和analysis。创建nsargo-demo#kubectlcreatensargo-demonamespace/argo-democreated启用Istio自动注入功能#kubectllabelnamespaceargo-demoistio-injection=enablednamespace/argo-demolabe......
  • Argo Rollouts AnalysisTemplate CRD
    AnalysisTemplateCRDapiVersion:argoproj.io/v1alpha1kind:AnalysisTemplatemetadata:name:success-ratespec:args:#模板参数,模板内部引用的格式为“{{args.NAME}}”;可在调用该模板时对其赋值;-name:<string>value:<string>valueF......
  • ArgoCD和Argo Rollouts自动化部署应用
    环境说明使用ArgoRollouts部署nginx应用:1.使用Rollout部署nginx2.采用canary部署策略3.结合Analysis进行渐进式交付4.结合IstioVirtualService进行自动化流量分割和流量迁移5.部署清单放在gitrepo中使用ArgoCD进行自动化部署:1.使用Application监视GitRepository2......
  • 阿里云 ACK One Serverless Argo 助力深势科技构建高效任务平台
    作者:田双坤、于雪前言深势科技是“AIforScience”科学研究范式的引领者和践行者,致力于运用人工智能和多尺度模拟仿真算法,结合先进计算手段求解重要科学问题,为人类文明最基础的生物医药、能源、材料和信息科学与工程研究打造新一代微尺度工业设计和仿真平台。对于深势的科学家和用......
  • 阿里云 ACK One Serverless Argo 助力深势科技构建高效任务平台
    作者:田双坤、于雪前言深势科技是“AIforScience”科学研究范式的引领者和践行者,致力于运用人工智能和多尺度模拟仿真算法,结合先进计算手段求解重要科学问题,为人类文明最基础的生物医药、能源、材料和信息科学与工程研究打造新一代微尺度工业设计和仿真平台。对于深势的科学......
  • cargo-make rust 任务执行以及构建工具
    再学习nakago框架的时候发现其使用了cargo-make这个工具,但是很方便,类似make的构建模式包含的特性依赖管理,别名支持,支持workspace简单使用安装cargoinstall--forcecargo-make参考使用创建一个cargo项目 cargonewappdemoMakefile.toml文件cargonewappdemoMakefile.to......
  • [转][译] 密码哈希的方法:PBKDF2,Scrypt,Bcrypt 和 ARGON2
    原文地址:PasswordHashing:PBKDF2,Scrypt,BcryptandARGON2原文作者:MichelePreziuso译文出自:掘金翻译计划本文永久链接:https://github.com/xitu/gold-miner/blob/master/TODO1/password-hashing-pbkdf2-scrypt-bcrypt-and-argon2.md译者:司徒公子校对者:xionglong58、GJX......