<p>According to the <a href="https://istio.io/docs/concepts/traffic-management/#virtual-services" rel="nofollow noreferrer">Istio documentation</a>, VirtualServices should be able to route requests to "a completely different service than was requested". I would like to use this feature give services different aliases in different applications.</p>

<p>I'm starting with a VirtualService definition like this:</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-vs
spec:
  hosts:
  - my-alias
  http:
  - route:
    - destination:
        host: my-service
</code></pre>

<p>The intention is that a client pod in the mesh should be able to send requests to <a href="http://my-alias" rel="nofollow noreferrer">http://my-alias</a> and have them routed to my-service. In the future I'll expand this with match rules to make the alias behave differently for different clients, but even the simple version isn't working.</p>

<p>With no other setup, the client fails to resolve my-alias via DNS. I can solve this by adding a selectorless k8s service named my-alias so its DNS resolves, but then the VirtualService doesn't seem to do the redirect. If I add an external host like google.com to the VirtualService, then it does successfully redirect any requests to google.com over to my-service. Using the full hostname (my-alias.default.svc.cluster.local) doesn't help.</p>

<p>So it seems like the VirtualService is not allowing me to redirect traffic bound for another service in the mesh. Is this expected, and is there a way I can work around it?</p>

<p>The problem ended up being that I was using unnamed ports for my services, so traffic never made it into the mesh. According to <a href="https://istio.io/docs/setup/kubernetes/spec-requirements/" rel="nofollow noreferrer">https://istio.io/docs/setup/kubernetes/spec-requirements/</a>, the HTTP port must be named <code>http</code>.</p>
