<p>I am trying to create a helm chart for my service with the following structure:</p>

<pre><code>.
├── my-app
│   ├── Chart.yaml
│   ├── templates
│   │   ├── deployment.yaml
│   │   ├── istio-virtualservice.yaml
│   │   └── service.yaml
│   └── values.yaml

</code></pre>

<p>After installing the helm chart the deployment and service are being created successfully but the virtualservice is not being created. </p>

<pre><code>$ helm install -name my-app ./my-app -n my-namespace
$ kubectl get pods -n my-namespace
NAME                              READY   STATUS    RESTARTS   AGE
my-app-5578cbb95-xzqzk            2/2     Running   0          5m

$ kubectl get vs
NAME                 GATEWAYS               HOSTS                         AGE
&lt;Empty&gt;
</code></pre>

<p>My istio virtual service yaml files looks like:</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-virtual-service
spec:
  hosts:
    - {{$.Values.props.host | quote}}
  gateways:
    - my-api-gateway
  http:
    - match:
        - uri:
            prefix: /app/
      rewrite:
        uri: "/"
      route:
        - destination:
            port:
              number: 8083
            host: my-service.my-namespace.svc.cluster.local
</code></pre>

<p>Surprisingly, if i apply the above yaml after helm install is done deploying the app then the virtualservice gets created. </p>

<pre><code>$ kubectl apply -f istio-vs.yaml
$ kubectl get vs
NAME                 GATEWAYS               HOSTS                         AGE
my-virtual-service   [my-api-gateway]   [my-host.com]                     60s

</code></pre>

<p>Please help me debug the issue and let me know if more debug information is needed.</p>

<pre><code>$ helm version
version.BuildInfo{Version:"v3.0.1", GitCommit:"7c22ef9ce89e0ebeb7125ba2ebf7d421f3e82ffa", GitTreeState:"clean", GoVersion:"go1.13.4"}
</code></pre>

<pre><code>$ istioctl version
client version: 1.4.1
control plane version: 1.4.1
data plane version: 1.4.1 (2 proxies)
</code></pre>

<pre><code>$ kubectl version
Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6-beta.0", GitCommit:"e7f962ba86f4ce7033828210ca3556393c377bcc", GitTreeState:"clean", BuildDate:"2020-01-15T08:26:26Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6-beta.0", GitCommit:"e7f962ba86f4ce7033828210ca3556393c377bcc", GitTreeState:"clean", BuildDate:"2020-01-15T08:18:29Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

Kapil Ratnani
<p><strong>Use</strong> </p>

<pre><code>kubectl get vs -n my-namespace
</code></pre>

<p><strong>instead of</strong> </p>

<pre><code>kubectl get vs
</code></pre>

<hr>

<p>That´s because you have deployed everything in the <strong>my-namespace</strong> namespace.</p>

<blockquote>
  <p>helm install -name my-app ./my-app -n <strong>my-namespace</strong></p>
</blockquote>

<p>And you´re searching for <a href="https://istio.io/docs/reference/config/networking/virtual-service/" rel="nofollow noreferrer">virtual service</a> in the <strong>default</strong> namespace.</p>

<hr>

<p>It´s working when you apply it by yourself, because there is no namespace in the virtual service yaml and it´s deployed in the default one. </p>

<hr>

<p>Additional info, I see you have <a href="https://istio.io/docs/reference/config/networking/gateway/" rel="nofollow noreferrer">gateway</a> which is already deployed, if it´s not in the same namespace as virtual service, you should add it like in below example.</p>

<p>Check the <code>spec.gateways</code> section</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo-Mongo
  namespace: bookinfo-namespace
spec:
  gateways:
  - some-config-namespace/my-gateway # can omit the namespace if gateway is in same
                                       namespace as virtual service.
</code></pre>

<hr>

<p>I hope this answer your question. Let me know if you have any more questions.</p>
