<p>I have loaded Grafana as an add-on from the Istio docs, i put it behind a sub domain for the main site.</p>
<p>But i need to build a custom load balancer for it, so that the sub domain can point to that.</p>
<p>This is what i have:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: grafana-ingressgateway
  namespace: istio-system
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 80
      name: http2
    - port: 443
      name: https
  selector:
    app.kubernetes.io/name: grafana-lb
    app.kubernetes.io/instance: grafana-lb
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: ingress-grafana-gateway-configuration
  namespace: istio-system
spec:
  selector:
    istio: grafana-ingressgateway
  servers:
  - port:
      number: 80
      name: grafana-http-ui
      protocol: HTTP
    hosts:
    - &quot;grafana.xxxx.com&quot;
    tls:
      httpsRedirect: false
  - port:
      number: 443
      name: grafana-https-ui
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: xxxx-cert
    hosts:
    - &quot;grafana.xxxx.com&quot;
---
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: grafana-virtual-service
  namespace: istio-system
spec:
  hosts:
    - &quot;grafana.xxxx.com&quot;
  gateways:
    - ingress-grafana-gateway-configuration
  http:
    - match:
      - uri:
          prefix: /
      route:
        - destination:
            host: grafana.istio-system.svc.cluster.local
</code></pre>
<p>But it's not loading, i have already updated the 'grafana' sub domain to point to the new load balancer. The cert is a wild card lets encrypt that is in the <code>istio-system</code> namespace.</p>
<p>Is this because I added to the same namespace as the default load balancer? I have not seen anything that says you cant run more than one LB in one NS?</p>
<p>Thanks,</p>

C0ol_Cod3r
<p>From what I see it's not working because creation of a  service is not enough to create a custom load balancer in Istio.</p>
<hr />
<p>If you want to create a custom gateway, then please refer to the following <a href="https://stackoverflow.com/questions/51835752/how-to-create-custom-istio-ingress-gateway-controller/51840872#51840872">answer</a>. You need to create it with either <a href="https://helm.sh/" rel="nofollow noreferrer">Helm</a> or <a href="https://istio.io/latest/docs/setup/install/operator/" rel="nofollow noreferrer">Istio Operator</a>.</p>
<p>Then you can use the selector to instruct your gateway to use the new custom ingress gateway, instead of the default one, which selector is <code>istio: ingressgateway</code>.</p>
<hr />
<p>As for your gateway configuration, if you want to use the following selector</p>
<pre><code>spec:
  selector:
    istio: grafana-ingressgateway
</code></pre>
<p>Then you should create this label on your custom grafana ingress gateway.</p>
<pre><code>gateways:
  enabled: true
  custom-grafana-ingressgateway:
    namespace: default
    enabled: true
    labels:
      istio: grafana-ingressgateway
</code></pre>
