百度智能云服务网格 CSM 使用教程 - Istio资源管理
文档简介:
概述:
服务网格CSM通过Istio CRD资源(如Virtual Service、Destination Rule)描述微服务治理策略,“Istio 资源”页面对通过控制台、原生API等不同方式提交的资源集中展示,用户可在“Istio 资源”页面按需进行增删改查操作。
概述
服务网格CSM通过Istio CRD资源(如Virtual Service、Destination Rule)描述微服务治理策略,“Istio 资源”页面对通过控制台、原生API等不同方式提交的资源集中展示,用户可在“Istio 资源”页面按需进行增删改查操作。
注意事项
- 对于注入了服务网格代理的工作负载,如没有提交任何Istio CRD,流量仍然会被代理劫持,以轮询的负载均衡方式发往目的服务的多个实例。
创建Istio资源
按以下步骤在控制台上创建与更改Istio CRD资源:
- 登录百度智能云控制台,选择“产品服务>云原生>服务网格 CSM”。
- 在服务网格控制台,“网格列表”页面选择地域后,找到相要操作的服务网格实例,点击服务网格实例名称可在左侧边栏看到Istio资源管理。
-
通过“创建 Istio 资源”按钮,即可进入Istio资源提交页面,目前暂只支持YAML提交。
-
Istio资源创建后,会立即下发至服务网格的数据面生效相关规则。
Istio 资源的命名空间,是指Istio资源的存储位置,生效的范围是在Spec字段中描述。
变更Istio资源
- 在“Istio 资源管理”页,通过点击Istio资源列表中具体的Istio资源名称或操作列的“编辑”按钮,即可进行编辑操作。
- 在“Istio 资源管理”页,通过Istio资源列表操作列的“删除”按钮,可以在控制台上完成Istio资源删除;如需多条资源进行批量删除,可以选中后通过Istio资源列表上方的“删除”进行批量操作。
参考示例
我们根据上述Sidecar自动注入、集群管理等手册操作完成后,我们给sleep/helloworld应用配置Istio CRD策略,具体如下所示:
VirtualService:
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: helloworld-vs
spec: hosts: - helloworld.test.svc.cluster.local exportTo: - test http: - route:
- destination: host: helloworld.test.svc.cluster.local subset: v1 weight: 100 - destination:
host: helloworld.test.svc.cluster.local subset: v2 weight: 0
DestinationRule:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: helloworld-dr
spec:
exportTo:
- test
host: helloworld.test.svc.cluster.local
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
通过Istio资源管理提交上述 Yaml 文件后,如下所示:
其他参考案例
Istio 社区示例