k8s expose virtual service with istio

12/11/2019

I’ve download the Prometheus helm chart https://github.com/helm/charts/tree/master/stable/prometheus

and deploy it to our cluster as-is and I was able to access prom ui via port-forwarding.

As we are using istio I want to configure it to access with host (lik external IP ) and I configure the following but it doesn’t work for me.

I mean if I put the host I don’t get anything in the browser, any idea what could be missing here ?

I dont see any exteranal-ip when running kubectl get svc -n mon ,

just internal-ip which doesnt help to our needs.

gateway.yaml

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: http-gateway
  namespace: mon
spec:
  selector:
    istio: ingressgateway
  servers:
    - hosts: mo-gateway.web-system.svc.cluster.local
      port:
        name: https-monitoring
        number: 443
        protocol: HTTPS
      tls:
        mode: SIMPLE
        privateKey: /etc/istio/sa-tls/tls.key
        serverCertificate: /etc/istio/sa-tls/tls.crt

virtual_service.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: prom-virtualservice
  namespace: mon
spec:
  hosts:
    -  mo-gateway.web-system.svc.cluster.locall
  gateways:
    - http-gateway
  http:
    - match:
        - uri:
            prefix: /prometheus
      route:
        - destination:
            host: prometheus-server
            port:
              number: 80

Any idea why it doesnt works ?

Btw, If I just change the type of Prometheus to use LoadBalancer it work, I was able to get external-ip and use it but not on istio

istio is up-and-running ...

-- Jenny M
azure
istio
kubernetes
kubernetes-ingress
prometheus

0 Answers