Chaos带你快速上手混沌工程实验报告

本文涉及的产品
云数据库 Tair(兼容Redis),内存型 2GB
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
简介: Chaos带你快速上手混沌工程实验报告

2. 创建应用

  1. 点击右侧 图标,切换到远程桌面操作界面。
  2. 双击打开虚拟桌面的Firefox ESR浏览器,在RAM用户登录框中点击“下一步”,复制云产品资源列表中子用户密码,粘按CTRL+V把密码粘贴到密码输区,登陆子账户(后续在远程桌面里的粘贴操作均使用CTRL + V快捷键)。
  3. 复制容器服务ACK控制台地址,在FireFox浏览器打开新页签,粘贴并访问容器服务ACK控制台。
https://cs.console.aliyun.com/
  1. 集群页面,单击详情

  1. 在左侧导航栏,单击无状态

  1. 无状态页面,单击使用YAML创建资源

  1. 创建页面,复制以下代码并粘贴到模板框中,然后单击创建
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nacos-server-app
spec:
  selector:
    matchLabels:
      app: nacos-server-app
  template:
    metadata:
      labels:
        app: nacos-server-app
    spec:
      containers:
        - name: nacos-standalone
          image: registry.cn-beijing.aliyuncs.com/ahas_demo/nacos:1.0.0
          ports:
            - containerPort: 8848
          env:
            - name: PREFER_HOST_MODE
              value: "hostname"
            - name: MODE
              value: "standalone"
          resources:
            limits:
              cpu: 1
              memory: 2048Mi
            requests:
              cpu: 200m
              memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
  name: nacos-server-app
spec:
  type: ClusterIP
  selector:
    app: nacos-server-app
  ports:
    - name: http
      port: 8848
      targetPort: 8848
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cart-redis
spec:
  selector:
    matchLabels:
      app: cart-redis
  replicas: 1
  template:
    metadata:
      labels:
        app: cart-redis
    spec:
      containers:
        - name: cart-redis
          image: redis:alpine
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 6379
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: cart-redis
  name: cart-redis
spec:
  ports:
    - port: 6379
      targetPort: 6379
  selector:
    app: cart-redis
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cartservice-app
spec:
  selector:
    matchLabels:
      app: cartservice-app
  template:
    metadata:
      labels:
        app: cartservice-app
    spec:
      containers:
        - name: cartservice-app
          image: registry.cn-beijing.aliyuncs.com/ahas_demo/cartservice:1.0.0
          imagePullPolicy: Always
          env:
            - name: dubbo.registry.address
              value: "nacos://nacos-server-app:8848"
            - name: spring.cloud.nacos.discovery.server-addr
              value: "nacos-server-app:8848"
            - name: spring.cloud.nacos.config.server-addr
              value: "nacos-server-app:8848"
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: recommendation-service
spec:
  selector:
    matchLabels:
      app: recommendation-service
  template:
    metadata:
      labels:
        app: recommendation-service
        version: 1.0.0-SNAPSHOT
    spec:
      containers:
        - name: recommendation-service
          image: registry.cn-beijing.aliyuncs.com/ahas_demo/recomendationservice:1.0.0
          # imagePullPolicy: Always
          env:
            - name: dubbo.registry.address
              value: "nacos://nacos-server-app:8848"
            - name: spring.cloud.nacos.discovery.server-addr
              value: "nacos-server-app:8848"
            - name: spring.cloud.nacos.config.server-addr
              value: "nacos-server-app:8848"
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: product-mysql
spec:
  selector:
    matchLabels:
      app: product-mysql
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: product-mysql
    spec:
      containers:
        - args:
            - --character-set-server=utf8mb4
            - --collation-server=utf8mb4_unicode_ci
          env:
            - name: MYSQL_DATABASE
              value: product
            - name: MYSQL_ROOT_PASSWORD
              value: productservice
          image: mysql:5.6
          name: product-mysql
          ports:
            - containerPort: 3306
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: product-mysql
  name: product-mysql
spec:
  ports:
    - port: 3306
      targetPort: 3306
  selector:
    app: product-mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: product-service
spec:
  selector:
    matchLabels:
      app: product-service
  template:
    metadata:
      labels:
        app: product-service
        version: 1.0.0-SNAPSHOT
    spec:
      containers:
        - name: product-service
          image: registry.cn-beijing.aliyuncs.com/ahas_demo/productservice:1.0.0
          imagePullPolicy: Always
          env:
            - name: dubbo.registry.address
              value: "nacos://nacos-server-app:8848"
            - name: spring.cloud.nacos.discovery.server-addr
              value: "nacos-server-app:8848"
            - name: spring.cloud.nacos.config.server-addr
              value: "nacos-server-app:8848"
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-mysql
spec:
  selector:
    matchLabels:
      app: checkout-mysql
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: checkout-mysql
    spec:
      containers:
        - args:
            - --character-set-server=utf8mb4
            - --collation-server=utf8mb4_unicode_ci
          env:
            - name: MYSQL_DATABASE
              value: checkout
            - name: MYSQL_ROOT_PASSWORD
              value: checkoutservice
          image: mysql:5.6
          name: checkout-mysql
          ports:
            - containerPort: 3306
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: checkout-mysql
  name: checkout-mysql
spec:
  ports:
    - port: 3306
      targetPort: 3306
  selector:
    app: checkout-mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-service
spec:
  selector:
    matchLabels:
      app: checkout-service
  template:
    metadata:
      labels:
        app: checkout-service
    spec:
      containers:
        - name: checkout-service
          image: registry.cn-beijing.aliyuncs.com/ahas_demo/checkoutservice:health
          imagePullPolicy: Always
          ports:
            - name: liveness-port
              containerPort: 8080
              protocol: TCP
          env:
            - name: dubbo.registry.address
              value: "nacos://nacos-server-app:8848"
            - name: spring.cloud.nacos.discovery.server-addr
              value: "nacos-server-app:8848"
            - name: spring.cloud.nacos.config.server-addr
              value: "nacos-server-app:8848"
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /health
              port: liveness-port
              scheme: HTTP
            initialDelaySeconds: 5
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          startupProbe:
            failureThreshold: 3
            httpGet:
              path: /health
              port: liveness-port
              scheme: HTTP
            initialDelaySeconds: 40
            periodSeconds: 5
            successThreshold: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: front-end
spec:
  selector:
    matchLabels:
      app: front-end
  template:
    metadata:
      labels:
        app: front-end
    spec:
      containers:
        - name: front-end
          image: registry.cn-beijing.aliyuncs.com/ahas_demo/frontend:async-test
          imagePullPolicy: Always
          ports:
            - name: liveness-port
              containerPort: 8080
              protocol: TCP
          env:
            - name: dubbo.registry.address
              value: "nacos://nacos-server-app:8848"
            - name: spring.cloud.nacos.discovery.server-addr
              value: "nacos-server-app:8848"
            - name: spring.cloud.nacos.config.server-addr
              value: "nacos-server-app:8848"
          resources:
            limits:
              cpu: 1
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 128Mi
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /health
              port: liveness-port
              scheme: HTTP
            initialDelaySeconds: 5
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          startupProbe:
            failureThreshold: 3
            httpGet:
              path: /health
              port: liveness-port
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 5
            successThreshold: 1
---
apiVersion: v1
kind: Service
metadata:
  name: front-end
spec:
  type: ClusterIP
  selector:
    app: front-end
  ports:
    - name: http
      port: 8080
      targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: frontend-external
spec:
  type: LoadBalancer
  selector:
    app: front-end
  ports:
    - name: http
      port: 8080
      targetPort: 8080

  1. 在左侧导航栏,单击无状态
  2. 无状态页面,等待几分钟,单击刷新,容器组数量全部为1/1之后,表示应用部署完成。

注意 :

如果出现某服务无法正常启动的情况,您只需单击目标服务右侧操作列表下的更多>重新部署即可。如果遇到frontend无法正常启动的情况,此时您需要先将checkoutservice重新部署后,再将frontend重新部署即可。

  1. 无状态页面,单击frontend

  1. frontend服务页面,单击访问方式页签。

  1. frontend服务的访问方式页签,单击frontend-external服务的外部端点。

若返回如下页面,表示应用部署成功。

  1. 商品概览页面,单击任意商品,例如Air Jordan Legacy 312

  1. 商品详情页面,单击添加购物车

  1. 购物车页面,单击确认订单

若返回如下页面,表示订单支付成功。

目录
相关文章
|
Dubbo Java 应用服务中间件
无论多忙,都要掌握混沌工程入门方法
无论多忙,都要掌握混沌工程入门方法
|
监控 安全 Devops
学习笔记之初识混沌工程
最早由Netflix的技术团队提出,现已经演变成计算机科学的一门新兴学科,即“混沌工程”。
学习笔记之初识混沌工程
同学,你还不知道什么是混沌测试吗?
同学,你还不知道什么是混沌测试吗?
|
监控 数据可视化 开发者
[译]混沌游戏日:混沌的手把手指南
> 原文:Chaos Gamedays: A Step-by-Step Guide to Chaos > [https://dzone.com/articles/chaos-gamedays-a-step-by-step-guide-to-chaos](https://dzone.com/articles/chaos-gamedays-a-step-by-step-guide-to-ch
494 0
|
Devops 测试技术
【混沌工程】混沌工程原理
混沌工程是在系统上进行实验的学科,目的是建立对系统承受生产中动荡条件的能力的信心。 大规模分布式软件系统的进步正在改变软件工程的游戏规则。作为一个行业,我们迅速采用提高开发灵活性和部署速度的做法。紧随这些好处之后的一个紧迫问题是:我们对投入生产的复杂系统有多少信心?
|
自然语言处理 Kubernetes 监控
ChaosBlade:从混沌工程实验工具到混沌工程平台
ChaosBlade 是阿里巴巴 2019 年开源的混沌工程项目,已加入到 CNCF Sandbox 中。起初包含面向多环境、多语言的混沌工程实验工具 ChaosBlade,到现在发展到面向多集群、多环境、多语言的混沌工程平台 chaosblade-box,平台支持实验工具托管和工具自动化部署,通过统一用户实验界面,将用户的精力聚焦在通过混沌工程解决云原生过程中高可用问题上。本文从混沌实验模型抽象、混沌实验工具开源和混沌工程平台升级项目三阶段出发,详细介绍 ChaosBlade。
663 4
ChaosBlade:从混沌工程实验工具到混沌工程平台
|
边缘计算 分布式计算 Kubernetes
一文读懂混沌工程
混沌工程通常用于测试分布式计算系统,以确保其能够承受意外的中断。混沌工程基于随机和不可预知行为的混沌理念,混沌工程的目标是通过引入随机和不可预知行为的受控实验来识别系统中的弱点。
1397 0
|
Web App开发 存储 Kubernetes
带你快速上手混沌工程
容器服务Kubernetes版(简称ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理;是国内唯一入选2020年Gartner公共云容器报告的产品,并在2019年Forrester容器报告中获国内排名第一;整合了阿里云虚拟化、存储、网络和安全能力,助力企业高效运行云端Kubernetes容器化应用。
215 0
带你快速上手混沌工程
|
Web App开发 Kubernetes 监控
Chaos带你快速上手混沌工程实战体验
Chaos带你快速上手混沌工程实战体验
203 0
Chaos带你快速上手混沌工程实战体验
|
监控 搜索推荐 容灾
Chaos带你快速上手混沌工程实战体验2
Chaos带你快速上手混沌工程实战体验2
441 0
Chaos带你快速上手混沌工程实战体验2