<p>I want to route 70% percentage of my traffic coming to service A to an external end point and append the URL.</p>

<p>To achieve this I created an externalName type service which points to external endpoint and then use treafik ingress controller to divide the weight in percentage.</p>

<p>My service definition looks something like this:  </p>

<pre><code>    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: wensleydale
    spec:
      ports:
      - name: http
        targetPort: 80
        port: 80
      selector:
        app: cheese
        task: wensleydale

    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: test-service
    spec:
      type: ExternalName
      externalName: www.google.com
      ports:
      - name: http
        targetPort: 80
        port: 80
      selector:
        app: cheese
        task: test-service
</code></pre>

<p>Ingress.yaml:</p>

<pre><code>    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      annotations:
        traefik.ingress.kubernetes.io/service-weights: |
          test-service: 70%
          wensleydale: 30%
      name: cheese
    spec:
      rules:
      - http:
          paths:
          - backend:
              serviceName: test-service
              servicePort: 80
            path: /
          - backend:
              serviceName: wensleydale
              servicePort: 80
            path: /
</code></pre>

<p>What I want in addition is when traffic goes to <code>test-service</code>, I want to append path.<br>
In my <code>test-service</code> I want the URL to be something like <code>www.google.com/something</code>  </p>

<p>I'm open to use other tools to achieve this. </p>

Aakash Singhal
<p>You can do the following:</p>

<ol>
<li><p>Use Istio Ingress Gateway instead of a traefik gateway. Istio Ingress Gateway is the recommended way for Ingress control in Istio. See <a href="https://istio.io/docs/tasks/traffic-management/ingress/" rel="nofollow noreferrer">https://istio.io/docs/tasks/traffic-management/ingress/</a></p></li>
<li><p>In the corresponding Virtual Service, use HTTPRewrite directive <a href="https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPRewrite" rel="nofollow noreferrer">https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPRewrite</a> :</p></li>
</ol>

<p><code>
    rewrite:
      uri: /something
</code></p>
