博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Istio] 外部访问Istio自带的Prometheus和Grafana
阅读量:2341 次
发布时间:2019-05-10

本文共 1493 字,大约阅读时间需要 4 分钟。

Isitio目前自带Prometheus和Grafana,但无法从外部访问,使用port forward只能从本地访问。运行下面的命令:

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

可以从本地curl到Prometheus的UI(curl localost:9090/graph):

curl localhost:9090/graph
想从外部浏览器访问到,需要将istio-demo.yaml文件中Prometheus和Grafana的Service改成NodePort类型,然后选择合适的nodePort:

# Source: istio/charts/prometheus/templates/service.yamlapiVersion: v1kind: Servicemetadata:  name: prometheus  namespace: istio-system  annotations:    prometheus.io/scrape: 'true'  labels:    name: prometheusspec:  type: NodePort #原来是ClusterIP,改成NodePort  selector:    app: prometheus  ports:  - name: http-prometheus    protocol: TCP    port: 9090    nodePort: 32339 #外部访问端口---# Source: istio/charts/grafana/templates/service.yamlapiVersion: v1kind: Servicemetadata:  name: grafana  namespace: istio-system  annotations:    auth.istio.io/3000: NONE  labels:    app: grafana    chart: grafana-0.1.0    release: RELEASE-NAME    heritage: Tillerspec:  type: NodePort #原来是没有type的,加上  ports:    - port: 3000      targetPort: 3000      protocol: TCP      name: http      nodePort: 32333 #加上外部访问端口  selector:    app: grafana

* nodePort要在30000到32767之间!!!!否则会报错:

The Service "grafana" is invalid: spec.ports[0].nodePort: Invalid value: 33333: provided port is not in the valid range. The range of valid ports is 30000-32767

重新部署istio-demo.yaml文件后、访问对应url,就会出现Prometheus(IP:32339/graph)和Grafana(IP:32333)的UI了。

Prometheus: status/service-discovery

Prometheus: status/targets

Grafana Dashboard

UI好看是好看,就是有点卡~~主要是性能指标的监控,从k8s的Mixer拿数据。

转载地址:http://aokvb.baihongyu.com/

你可能感兴趣的文章
linux内核手动配置学习
查看>>
linux下C编程风格点滴
查看>>
Copy_from&to_user详解
查看>>
Netty 源码分析-服务端
查看>>
Netty 源码分析-ChannelPipeline
查看>>
分库分表的起源
查看>>
【深入理解JVM虚拟机】第1章 走进java
查看>>
【深入理解JVM虚拟机】第2章 java内存区域与内存溢出异常
查看>>
【深入理解JVM虚拟机】第3章 垃圾收集器与内存分配策略
查看>>
性能优化-jvm
查看>>
性能优化-mysql
查看>>
性能优化-tomcat
查看>>
JVM内存模型、指令重排、内存屏障概念解析
查看>>
【java基础】集合框架总结
查看>>
Elasticsearch-基础介绍及索引原理分析
查看>>
【C++】二、指针数组与数组指针
查看>>
【C++】三、const与字符串
查看>>
【C++】四、重载,重写,重定义
查看>>
【C++】六、继承与多态
查看>>
特征向量的欧式距离与余弦距离——推荐算法
查看>>