带你快速上手混沌工程

  1. 双击打开虚拟桌面的Firefox ESR浏览器,在RAM用户登录框中点击“下一步”,复制云产品资源列表中子用户密码,粘按CTRL+V把密码粘贴到密码输区,登陆子账户(后续在远程桌面里的粘贴操作均使用CTRL + V快捷键)。
  2. 复制容器服务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. 购物车页面,单击确认订单

带你快速上手混沌工程

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

带你快速上手混沌工程

安装探针

  1. 回到容器服务控制台页面,单击左侧导航栏上方的带你快速上手混沌工程图标。

带你快速上手混沌工程

  1. 集群列表页面的左侧导航栏中,单击应用目录

带你快速上手混沌工程

  1. 应用目录页面,单击ack-ahas-pilot

带你快速上手混沌工程

  1. 在ack-ahas-pilot的详情页面,单击创建

带你快速上手混沌工程

返回如下页面,表示探针已经部署完成。

带你快速上手混沌工程

通过使用MSHA快速体验异地、同城多活容灾。动手实验室地址:https://developer.aliyun.com/adc/scenario/998a993afe624e3eadcf5f8f6b791064

带你快速上手混沌工程

上一篇:IT安全交给MSP,企业能当“甩手掌柜”吗?


下一篇:科技云报道:微软收购边缘计算公司Affirmed Network,欲在5G领域抢夺一杯羹?