首页 > 其他分享 >部署argo-rollouts

部署argo-rollouts

时间:2022-11-13 17:33:21浏览次数:57  
标签:kubectl rollouts 部署 spring boot helloworld argo

https://github.com/argoproj/argo-rollouts/releases

kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/download/v1.3.1/install.yaml
kubectl apply -f https://github.com/argoproj/argo-rollouts/releases/download/v1.3.1/dashboard-install.yaml -n argo-rollouts

 查看资源

[root@master ~]# kubectl get pods -n argo-rollouts
NAME                                       READY   STATUS    RESTARTS   AGE
argo-rollouts-7f75b9fb76-r2zx6             1/1     Running   0          18m
argo-rollouts-dashboard-7dc4f88f5b-dj4dh   1/1     Running   0          7m28s

将argo-rollouts-dashboard暴露出来

[root@master argo-rollouts]# kubectl apply -f 03-argo-rollouts-dashboard-virtualservice.yaml 
[root@master argo-rollouts]# cat 03-argo-rollouts-dashboard-virtualservice.yaml 
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: argo-rollouts-dashboard
  namespace: argo-rollouts
spec:
  host: argo-rollouts-dashboard
  trafficPolicy:
    tls:
      mode: DISABLE
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: argo-rollouts-dashboard-gateway
  namespace: istio-system
spec:
  selector:
    app: istio-ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "argo-rollouts.yang.com"
    - "rollouts.yang.com"
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: argo-rollouts-dashboard-virtualservice
  namespace: argo-rollouts
spec:
  hosts:
  - "argo-rollouts.yang.com"
  - "rollouts.yang.com"
  gateways:
  - istio-system/argo-rollouts-dashboard-gateway
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: argo-rollouts-dashboard
        port:
          number: 3100
---

下载kubectl-argo-rollouts

[root@master argo-rollouts]# wget https://github.com/argoproj/argo-rollouts/releases/download/v1.3.1/kubectl-argo-rollouts-linux-amd64
[root@master argo-rollouts]# cp kubectl-argo-rollouts-linux-amd64 /usr/bin/kubectl-argo-rollouts
[root@master argo-rollouts]# chmod +x /usr/bin/kubectl-argo-rollouts
[root@master argo-rollouts]# kubectl argo rollouts
[root@master argo-rollouts]# ln -sv /usr/bin/kubectl-argo-rollouts /usr/bin/kubectl-rollouts
‘/usr/bin/kubectl-rollouts’ -> ‘/usr/bin/kubectl-argo-rollouts’

 示例 部署一个rollouts

[root@master 08-argo-rollouts]# kubectl apply -f 01-argo-rollouts-demo.yaml 
rollout.argoproj.io/rollouts-spring-boot-helloworld created
service/spring-boot-helloworld created
[root@master 08-argo-rollouts]# cat 01-argo-rollouts-demo.yaml 
# CopyRight: MageEdu <http://www.magedu.com>
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollouts-spring-boot-helloworld
spec:
  replicas: 10 
  strategy:
    canary:
      steps:
      - setWeight: 10 
      - pause: {}
      - setWeight: 20
      - pause: {duration: 20}
      - setWeight: 30
      - pause: {duration: 20}
      - setWeight: 40
      - pause: {duration: 20}
      - setWeight: 60
      - pause: {duration: 20}
      - setWeight: 80
      - pause: {duration: 20}
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: spring-boot-helloworld
  template:
    metadata:
      labels:
        app: spring-boot-helloworld
    spec:
      containers:
      - name: spring-boot-helloworld
        image: ikubernetes/spring-boot-helloworld:v0.9.1
        ports:
        - name: http
          containerPort: 80
          protocol: TCP
        resources:
          requests:
            memory: 32Mi
            cpu: 50m
        livenessProbe:
          httpGet:
            path: '/'
            port: 80
            scheme: HTTP
          initialDelaySeconds: 3
        readinessProbe:
          httpGet:
            path: '/'
            port: 80
            scheme: HTTP
          initialDelaySeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: spring-boot-helloworld
spec:
  ports:
  - port: 80
    targetPort: http
    protocol: TCP
    name: http
  selector:
    app: spring-boot-helloworld

 web界面查看

[root@master ~]# kubectl get pods
NAME                                               READY   STATUS              RESTARTS   AGE
rollouts-spring-boot-helloworld-5dc94d6f9d-24p4p   0/1     ContainerCreating   0          73s
rollouts-spring-boot-helloworld-5dc94d6f9d-4ptkb   0/1     Running             0          72s
rollouts-spring-boot-helloworld-5dc94d6f9d-8qgb2   0/1     ContainerCreating   0          73s
rollouts-spring-boot-helloworld-5dc94d6f9d-9gprm   1/1     Running             0          72s
rollouts-spring-boot-helloworld-5dc94d6f9d-9jbzm   0/1     Running             0          72s
rollouts-spring-boot-helloworld-5dc94d6f9d-fl7tm   0/1     Running             0          73s
rollouts-spring-boot-helloworld-5dc94d6f9d-k8s9h   0/1     ContainerCreating   0          73s
rollouts-spring-boot-helloworld-5dc94d6f9d-lpkgp   0/1     Running             0          73s
rollouts-spring-boot-helloworld-5dc94d6f9d-mgn7q   0/1     Running             0          73s
rollouts-spring-boot-helloworld-5dc94d6f9d-x5drx   0/1     Running             0          73s
[root@master ~]# kubectl get rollouts
NAME                              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
rollouts-spring-boot-helloworld   10        10        10           3           7m29s
[root@master ~]# kubectl-rollouts list rollouts
NAME                             STRATEGY   STATUS        STEP   SET-WEIGHT  READY  DESIRED  UP-TO-DATE  AVAILABLE
rollouts-spring-boot-helloworld  Canary     Progressing   12/12  100         5/10   10       10          5
[root@master ~]# kubectl-rollouts get rollouts rollouts-spring-boot-helloworld
Name:            rollouts-spring-boot-helloworld
Namespace:       default
Status:          ✔ Healthy
Strategy:        Canary
  Step:          12/12
  SetWeight:     100
  ActualWeight:  100
Images:          ikubernetes/spring-boot-helloworld:v0.9.1 (stable)
Replicas:
  Desired:       10
  Current:       10
  Updated:       10
  Ready:         10
  Available:     10

NAME                                                         KIND        STATUS     AGE    INFO
⟳ rollouts-spring-boot-helloworld                            Rollout     ✔ Healthy  8m44s  
└──# revision:1                                                                            
   └──⧉ rollouts-spring-boot-helloworld-5dc94d6f9d           ReplicaSet  ✔ Healthy  8m33s  stable
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-24p4p  Pod         ✔ Running  2m55s  ready:1/1,restarts:1
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-8qgb2  Pod         ✔ Running  2m55s  ready:1/1
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-fl7tm  Pod         ✔ Running  2m55s  ready:1/1,restarts:1
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-k8s9h  Pod         ✔ Running  2m55s  ready:1/1,restarts:2
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-lpkgp  Pod         ✔ Running  2m55s  ready:1/1
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-mgn7q  Pod         ✔ Running  2m55s  ready:1/1,restarts:2
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-x5drx  Pod         ✔ Running  2m55s  ready:1/1,restarts:2
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-4ptkb  Pod         ✔ Running  2m54s  ready:1/1
      ├──□ rollouts-spring-boot-helloworld-5dc94d6f9d-9gprm  Pod         ✔ Running  2m54s  ready:1/1
      └──□ rollouts-spring-boot-helloworld-5dc94d6f9d-9jbzm  Pod         ✔ Running  2m54s  ready:1/1

更新测试 

[root@master ~]# kubectl-rollouts get rollouts rollouts-spring-boot-helloworld -w
[root@master ~]# kubectl-rollouts set image rollouts-spring-boot-helloworld spring-boot-helloworld=ikubernetes/spring-boot-helloworld:v0.9.2
rollout "rollouts-spring-boot-helloworld" image updated

 可以看到revision:2已经开始更新了

web界面也可以看到已经更新了一个pod

命令行继续更新,会每隔20秒按比例更新

[root@master ~]kubectl get rollouts
NAME                              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
rollouts-spring-boot-helloworld   10        10        10           10          23h
[root@master ~]# kubectl argo rollouts promote rollouts-spring-boot-helloworld 

更新前也可以访问测试下

[root@master ~]# kubectl run client-$RANDOM --image ikubernetes/admin-box:v1.2 --restart=Never -it --rm --command -- /bin/bash
root@client-18539 /# while true; do curl spring-boot-helloworld/version; sleep .5; done

 

 

标签:kubectl,rollouts,部署,spring,boot,helloworld,argo
From: https://www.cnblogs.com/zyyang1993/p/16884212.html

相关文章

  • 使用JAX构建强化学习agent并借助TensorFlowLite将其部署到Android应用中
    在之前发布文章《一个新TensorFlowLite示例应用:棋盘游戏》中,展示了如何使用TensorFlow和TensorFlowAgents来训练强化学习(RL)agent,使其玩一个简单棋盘游戏“Pl......
  • LINUX CENTOS7 部署步骤 nacos
    0.下载nacos,nacos-server-2.1.2.tar.gzhttps://nacos.io/zh-cn/docs/quick-start.htmlhttps://github.com/alibaba/nacos/tags1.解压tar包tar-xvfnacos-server-2......
  • Helm部署和体验jenkins
    欢迎访问我的GitHub这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos运行在Kubernetes上的Jenkins下图来自rancher官方博客,在kubern......
  • harbor 部署-与高可用
    harbor部署-与高可用复制功能的目标1.首先要两个节点上都要部署harbor仓库2.然后让他们相互的复制,达到镜像统一一致3.最后使用keepalived,都部署上,达到高可用性1)前......
  • 关于 Angular 部署以及 index.html 里 base hRef 属性的关联关系
    直接在SAP电商云SpartacusUI项目下,运行命令行ngbuild,输出如下:dist文件夹:把dist文件夹下的mystore直接放到tomcatwebapps文件夹下面,运行时:如果修改......
  • k8S中部署Filebeat+ELK日志系统
    一.概述ELK是三个开源软件的缩写,分别表示:Elasticsearch,Logstash,Kibana,它们都是开源软件。新增了一个FileBeat,它是一个轻量级的日志收集处理工具(Agent),Filebeat......
  • 【Javaweb】做一个房产信息管理系统三(src目录的部署工作【三层框架】各个层含义)
    接下来,我打算进行Java文件的部署工作,但实际上为了得到更多的分数,我们还是应该先做页面首先我们需要了解对于Javaweb,src下的目录应该如何部署:(三层架构单独开一篇讲) 那......
  • 单服务器部署CTFd+whale踩坑
    单服务器部署CTFd+whale踩坑环境:os:ubuntu16Docker:Version:20.10.7Docker-compose:versionv2.12.1参考:https://www.zhaoj.in/read-6333.html/comment-page-1#_......
  • 上网部署(锐捷睿易篇)
    大家好,我是小杜!啦啦啦,精神小杜上线啦,为什么这么高兴啊,因为师傅今天开始带我熟悉设备的上网配置部署哈,虽然不是“实战”,但是这个是我”万里长征“的第一步。(别问为什么周......
  • docker部署
    1,下载docker-composecurl-Lhttps://get.daocloud.io/docker/compose/releases/download/v2.4.1/docker-compose-`uname-s`-`uname-m`>/usr/local/bin/docker-comp......