【问题标题】:How to access istio created dashboard如何访问 istio 创建的仪表板
【发布时间】:2019-09-21 17:23:32
【问题描述】:

我在 kubernetes 上安装了 istio 而没有 helm。

我可以看到在 istio-system 命名空间中创建了 pod 和服务。

所有服务如grafana,Prometheus都被创建并且它们的端口没有被暴露。

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

我尝试了 istio 文档推荐的端口转发:

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,但不适用于 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 仪表板

【问题讨论】:

  • “无舵安装”是什么意思?
  • 在 Kubernetes 上安装 istio 有两种方法,一种是不带 helm,另一种是带 helm。 Helm 是一种简化安装和管理 Kubernetes 应用程序的工具。把它想象成 Kubernetes 的 apt/yum/homebrew
  • 我知道 helm 是什么,但是不再推荐安装没有 helm 的 istio,甚至没有真正记录 1.1 版本。无论如何,我认为这不会改变任何事情。执行curl -v xxxx-yyyy.us-west-2.elb.amazonaws.com 会得到什么?

标签: linux amazon-web-services kubernetes portforwarding istio


【解决方案1】:
kubectl -n istio-system  port-forward svc/kiali 20001

然后点击http://localhost:20001/kiali/

【讨论】:

  • 但是 localhost 是 Linux VM。为了访问仪表板,我为该 VM 分配了公共 IP,并尝试通过 Internet 访问它,但它无法正常工作
  • 如果我想使用公共 IP 而不是 localhost 访问 20001 端口怎么办
【解决方案2】:

您可以创建Istio Gateway and VirtualService 以便将您的请求转发到默认在端口3000 上运行的grafana 服务

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

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 地址运行。

然后我们创建gateway 来使用这个默认的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的路由,用于通过此网关进入的流量:

$ 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://&lt;public_ip_istio_ingressgateway&gt;,你应该会看到 grafana 仪表板

希望对你有帮助。

【讨论】:

  • 你知道我是否在 3000 端口上转发了 grafana 并且我想使用该主机的公共 IP 访问它? (如果我不想一直在互联网上公开几个仪表板)
猜你喜欢
  • 2020-01-23
  • 1970-01-01
  • 2020-03-07
  • 1970-01-01
  • 1970-01-01
  • 2020-06-02
  • 2021-12-04
  • 2017-11-21
  • 2012-08-25
相关资源
最近更新 更多