How to access grafana-istio dashboard using ip address?

9/23/2019

I am using minikube to run kubernetes cluster. I followed the setup given in Istio Docs to install istio plugin. I am able to access the dashboard using localhost:3000 but unable to access using ip:3000.

Checked firewall. It isn’t blocking any port.

-- Achal Shah
grafana
istio
kubernetes
microservices
minikube

3 Answers

9/23/2019

You need to make grafana service type NodePort for this. You can change it with $ kubectl edit svc grafana -n istio-system and change .spec.type from ClusterIP to NodePort then save and quit editor.

To access grafana $ kubectl get svc grafana -n istio-system and get NodePort field then access it via ip:$NodePortValue

-- Akın Özer
Source: StackOverflow

9/23/2019

Check for the grafana service type.

You can use NodePort or LoadBalancer as the service type.

Use NodePort with ip or you can simply use the IP address of LoadBalancer to access the service online of grafana vai internet.

-- Harsh Manvar
Source: StackOverflow

9/24/2019

Unfortunately, if you are using istio it's not so easy to just change service type. You have to configure Istio VirtualService and create Gateway.

I am posting this answer as community wiki related to another stack case: https://stackoverflow.com/a/56019381/11148139 As mentioned question have 1 downvote and might be delete in the future I am posting for future use in this case.

\============================================

You can create Istio Gateway and VirtualService in order to forward your requests to grafana service running by default on port 3000

Firstly, let's check grafana and istio-ingressgateway service

kubectl get svc grafana istio-ingressgateway -n istio-system
NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP                                                               PORT(S)                                                                                                                                      AGE
grafana                ClusterIP      100.71.67.105   <none>                                                                    3000/TCP                                                                                                                                     18h
istio-ingressgateway   LoadBalancer   100.64.42.106   <Public IP address>   15020:31766/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:32576/TCP,15030:30728/TCP,15031:31037/TCP,15032:31613/TCP,15443:32501/TCP   18h

So, we have grafana running service listening on port 3000, and default istio-ingressgateway LoadBalancer service running with assigned public ip address.

Then we create gateway to use this default LoadBalancer.

$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: grafana-gateway
  namespace: istio-system # Use same namespace with backend service
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 80
      name: HTTP
      protocol: HTTP
    hosts:
    - "*"
EOF

Then configure route to grafana service for traffic entering via the this gateway:

$ kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana
  namespace: istio-system # Use same namespace with backend service
spec:
  hosts:
  - "*"
  gateways:
  - grafana-gateway # define gateway name
  http:
  - match:
    - uri:
        prefix: "/"
    route:
    - destination:
        port:
          number: 3000 # Backend service port
        host: grafana # Backend service name
EOF

Then hit the http://<public_ip_istio_ingressgateway>, you should see the grafana dashboard

I hope it will be helpful for you.

-- PjoterS
Source: StackOverflow