Updated on 2025-04-25 GMT+08:00

Creating a Service Route

Creating a Service Route Using YAML

The following uses an HTTP matching condition as an example to describe how to create a service route using YAML.

  1. Log in to the UCS console. In the navigation pane, choose Service Meshes.
  2. Click the name of the target service mesh to go to its details page.
  3. In the navigation pane, choose Traffic Governance > Service Router.
  4. Click Create from YAML in the upper right corner.
  5. Select YAML for Current Data and edit the configuration in the editing area. (Configure the parameters based on site requirements.)

    apiVersion: networking.istio.io/v1beta1
    kind: VirtualService
    metadata:
      name: ratings-route
    spec:
      hosts:
      - ratings.prod.svc.cluster.local
      http:
      - match:
        - headers:
            end-user:
              exact: jason
          uri:
            prefix: "/ratings/v2/"
        route:
        - destination:
            host: ratings.prod.svc.cluster.local

  6. Click OK.