如何访问istio创建的仪表板 [英] How to access istio created dashboard

查看:125
本文介绍了如何访问istio创建的仪表板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在没有掌舵的 kubernetes 上安装了 istio .

I installed istio on kubernetes without helm.

我可以看到pod和服务是在istio-system名称空间中创建的.

I can see pods and services are created in istio-system namespace.

创建了诸如grafana,Prometheus之类的所有服务,并且未公开其端口.

All service like grafana, Prometheus are created and their ports are not exposed.

由于创建了负载均衡器服务,因此在AWS中也创建了一个负载均衡器,我想通过新创建的负载均衡器终端节点从外部网络访问grafana,prometheus等仪表板,但无法从负载均衡器访问该仪表板端点.

As load-balancer-service is created so that one load balancer is also created in AWS, I wanted to access grafana, prometheus etc dashboard from an external network through newly created load balancer endpoint but that dashboard is not accessible from load balancer endpoint.

我尝试了istio docs建议的端口转发:

I tried port forwarding recommended by istio docs:

kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 & 

这些仅与 http://localhost:3000 一起使用,但不能与

These is working with only http://localhost:3000 but not accessible with http://publicip:3000

NAME                     TYPE           CLUSTER-IP       EXTERNAL-IP                                                              PORT(S)                                                                                                                                      AGE
grafana                  ClusterIP      172.20.192.71    <none>                                                                   3000/TCP                                                                                                                                     1m
istio-citadel            ClusterIP      172.20.111.103   <none>                                                                   8060/TCP,15014/TCP                                                                                                                           1m
istio-egressgateway      ClusterIP      172.20.123.112   <none>                                                                   80/TCP,443/TCP,15443/TCP                                                                                                                     1m
istio-galley             ClusterIP      172.20.45.229    <none>                                                                   443/TCP,15014/TCP,9901/TCP                                                                                                                   1m
istio-ingressgateway     LoadBalancer   172.20.94.157    xxxx-yyyy.us-west-2.elb.amazonaws.com   15020:31336/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:32146/TCP,15030:30126/TCP,15031:31506/TCP,15032:30501/TCP,15443:31053/TCP   1m
istio-pilot              ClusterIP      172.20.27.87     <none>                                                                   15010/TCP,15011/TCP,8080/TCP,15014/TCP                                                                                                       1m
istio-policy             ClusterIP      172.20.222.108   <none>                                                                   9091/TCP,15004/TCP,15014/TCP                                                                                                                 1m
istio-sidecar-injector   ClusterIP      172.20.240.198   <none>                                                                   443/TCP                                                                                                                                      1m
istio-telemetry          ClusterIP      172.20.157.227   <none>                                                                   9091/TCP,15004/TCP,15014/TCP,42422/TCP                                                                                                       1m
jaeger-agent             ClusterIP      None             <none>                                                                   5775/UDP,6831/UDP,6832/UDP                                                                                                                   1m
jaeger-collector         ClusterIP      172.20.92.248    <none>                                                                   14267/TCP,14268/TCP                                                                                                                          1m
jaeger-query             ClusterIP      172.20.168.197   <none>                                                                   16686/TCP                                                                                                                                    1m
kiali                    ClusterIP      172.20.236.20    <none>                                                                   20001/TCP                                                                                                                                    1m
prometheus               ClusterIP      172.20.21.205    <none>                                                                   9090/TCP                                                                                                                                     1m
tracing                  ClusterIP      172.20.231.66    <none>                                                                   80/TCP                                                                                                                                       1m
zipkin                   ClusterIP      172.20.200.32    <none>                                                                   9411/TCP                                                                                                                                     1m

如上所示,我正在尝试使用负载平衡器和端口转发来访问grafana仪表板,但我没有grafana仪表板

As shown in above I'm trying to access grafana dashboard using load balncer as well as port forwarding but I haven't get grafana dashboard

推荐答案

您可以创建

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

首先,让我们检查grafanaistio-ingressgateway服务

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

因此,我们有grafana运行服务在端口3000上侦听,而默认的istio-ingressgateway LoadBalancer服务正在使用分配的公共IP地址运行.

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

然后我们创建gateway来使用此默认LoadBalancer.

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

然后为通过此网关进入的流量配置到grafana service的路由:

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

然后点击http://<public_ip_istio_ingressgateway>,您应该会看到grafana仪表板

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

希望对您有所帮助.

这篇关于如何访问istio创建的仪表板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆