部署bookinfo应用到CSM实例 本章节介绍如何部署bookinfo应用到CSM实例 前提条件 1. 已开通云容器引擎,至少有一个云容器引擎实例。产品入口:云容器引擎。 2. 开通天翼云服务网格实例。 操作步骤 创建命名空间 首先到云容器引擎控制台找到当前添加到服务网格的云容器引擎集群,创建测试应用部署的sample命名空间,同时给命名空间打上istioinjection: enabled的标签以保证该命名空间下的pod会被注入sidecar。 部署应用 使用如下yaml部署我们的bookinfo应用,注意根据当前集群所在的资源池替换镜像的地址(当前云容器引擎实例在华东1资源池);如果您想要把演示应用部署到其他namespace也可以修改yaml里面的namespace字段实现,示例yaml如下: apiVersion: v1 kind: Service metadata: name: details labels: withServiceMesh: "true" workloadKind: Deployment workloadName: detailsv1 spec: ports: port: 9080 targetPort: 9080 name: http selector: app: details apiVersion: apps/v1 kind: Deployment metadata: name: detailsv1 labels: withServiceMesh: "true" spec: replicas: 1 selector: matchLabels: name: detailsv1 template: metadata: labels: app: details version: v1 name: detailsv1 source: CCSE csmAutoEnable: "on" "sidecar.istio.io/inject": "true" annotations: "sidecar.istio.io/inject": "true" spec: containers: name: details image: 'registryvpccrshuadong1.cnspinternal.ctyun.cn/library/istioexamplesbookinfodetailsv1:1.16.2' imagePullPolicy: IfNotPresent resources: limits: cpu: "200m" memory: "256Mi" requests: cpu: "50m" memory: "64Mi" apiVersion: v1 kind: Service metadata: name: ratings labels: withServiceMesh: "true" workloadKind: Deployment workloadName: ratingsv1 spec: ports: port: 9080 targetPort: 9080 name: http selector: app: ratings apiVersion: apps/v1 kind: Deployment metadata: name: ratingsv1 labels: withServiceMesh: "true" spec: replicas: 1 selector: matchLabels: name: ratingsv1 template: metadata: labels: app: ratings version: v1 name: ratingsv1 source: CCSE "sidecar.istio.io/inject": "true" csmAutoEnable: "on" annotations: "sidecar.istio.io/inject": "true" spec: containers: name: ratings image: 'registryvpccrshuadong1.cnspinternal.ctyun.cn/library/istioexamplesbookinforatingsv1:1.16.2' imagePullPolicy: IfNotPresent resources: limits: cpu: "200m" memory: "256Mi" requests: cpu: "50m" memory: "64Mi" apiVersion: v1 kind: Service metadata: name: reviews labels: withServiceMesh: "true" workloadKind: Deployment workloadName: reviewsv1 spec: ports: port: 9080 targetPort: 9080 name: http selector: app: reviews apiVersion: apps/v1 kind: Deployment metadata: name: reviewsv1 labels: withServiceMesh: "true" spec: replicas: 1 selector: matchLabels: name: reviewsv1 template: metadata: labels: app: reviews version: v1 name: reviewsv1 source: CCSE "sidecar.istio.io/inject": "true" csmAutoEnable: "on" annotations: "sidecar.istio.io/inject": "true" spec: containers: name: reviews image: 'registryvpccrshuadong1.cnspinternal.ctyun.cn/library/istioexamplesbookinforeviewsv1:1.16.2' imagePullPolicy: IfNotPresent env: name: LOGDIR value: "/tmp/logs" volumeMounts: name: tmp mountPath: /tmp name: wlpoutput mountPath: /opt/ibm/wlp/output volumes: name: wlpoutput emptyDir: {} name: tmp emptyDir: {} apiVersion: v1 kind: Service metadata: name: productpage labels: withServiceMesh: "true" workloadKind: Deployment workloadName: productpagev1 spec: ports: port: 9080 targetPort: 9080 name: http selector: app: productpage type: NodePort apiVersion: apps/v1 kind: Deployment metadata: name: productpagev1 labels: withServiceMesh: "true" spec: replicas: 1 selector: matchLabels: name: productpagev1 template: metadata: labels: app: productpage version: v1 name: productpagev1 source: CCSE "sidecar.istio.io/inject": "true" csmAutoEnable: "on" annotations: "sidecar.istio.io/inject": "true" spec: containers: name: productpage image: 'registryvpccrshuadong1.cnspinternal.ctyun.cn/library/istioexamplesbookinfoproductpagev1:1.16.2' imagePullPolicy: IfNotPresent resources: limits: cpu: "200m" memory: "256Mi" requests: cpu: "50m" memory: "64Mi" volumeMounts: name: tmp mountPath: /tmp volumes: name: tmp emptyDir: {} 在云容器引擎控制台选择我们要部署的sample命名空间,通过工作负载>无状态>新增yaml,依次部署上面的deployment; 通过网络>服务>新增yaml依次部署上面的Service填入我们准备的yaml文件,保存即可; 部署完成后,可以在工作负载>无状态列表里看到bookinfo相关的部署信息,在网络>Service菜单下可以看到刚部署的Service列表。