<p>I've deployed successfully an app to K8s with istio</p>
<p>We have gw which we use and virtual service like the following:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bher-virtualservice
  namespace: ba-trail 
spec:
  gateways:
    - bher-gateway 
  hosts:
    - trialio.cloud.str
  http:
    - match:
      - uri:
          prefix: &quot;/&quot;
      - uri:
          prefix: &quot;/login&quot;
      - uri:
          prefix: &quot;/static&quot;
      - uri:
          regex: '^.*\.(ico|png|jpg)$'
      route:
      - destination:
          host: bsa.ba-trail.svc.cluster.local service.namespace.svc.cluster.local
          port:
            number: 5000
</code></pre>
<p>I defined also a <code>service</code> and <code>deployment</code>.</p>
<p>I want to expose the service outside that I will be able to access
like:</p>
<pre class="lang-sh prettyprint-override"><code>https://myapp.host:5000
</code></pre>
<p>when I run:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get svc istio-ingressgateway -n istio-system


NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP                                                                  PORT(S)                                      AGE
istio-ingressgateway   LoadBalancer   100.61.114.202   a7151b2063cb-200880.eu-central-1.elb.amazonaws.com   150210:31161/TCP,80:31280/TCP,443:31190/TCP   41d
</code></pre>
<p>How it can be done?</p>
<p>I was able to run the app with port forwarding but I want a direct external link.</p>

Jenny M
<p>So in your case, you have an ELB serving your istio ingress gateway that goes to a VirtualService that directs traffic to port <code>5000</code> in the container.</p>
<p>I assume that you have it working with 🤔💭:</p>
<ul>
<li><code>a7151b2063cb-200880.eu-central-1.elb.amazonaws.com:80</code> and</li>
<li><code>a7151b2063cb-200880.eu-central-1.elb.amazonaws.com:443</code> ❓</li>
</ul>
<p>and you want something like:</p>
<ul>
<li><code>a7151b2063cb-200880.eu-central-1.elb.amazonaws.com:5000</code> ❓</li>
</ul>
<p>but with a specific name that maps to</p>
<ul>
<li><code>myapp.host</code> ❓</li>
</ul>
<p>First, you have to create a DNS CNAME record that maps <code>myapp.host</code> to <code>a7151b2063cb-200880.eu-central-1.elb.amazonaws.com</code>.</p>
<p>Then on the Kubernetes service <code>istio-ingressgateway</code> you probably have something like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
  namespace: istio-system
  labels:
    name: istio-ingress-service
  annotations:
    ... (❓)
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: ❓
    protocol: TCP
  - port: 443
    targetPort: ❓
    protocol: TCP
  selector:
    name: something-that-matches-your-istio-ingress
</code></pre>
<p>You could just add the extra port to the service so that it listens on that port on the outside.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
  namespace: istio-system
  labels:
    name: istio-ingress-service
  annotations:
    ... (❓)
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: ❓
    protocol: TCP
  - port: 443
    targetPort: ❓
    protocol: TCP
  - port: 5000
    targetPort: ❓
  selector:
    name: something-that-matches-your-istio-ingress
</code></pre>
<p>Finally, the virtual service needs to match your hostname <code>myapp.host</code></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bher-virtualservice
  namespace: ba-trail 
spec:
  gateways:
    - bher-gateway 
  hosts:
    - myapp.host 
...
</code></pre>
<p>✌️</p>
