OpenShift 4.13中如何直接访问Prometheus UI?
在OpenShift 4.13中访问Prometheus UI的可行方法
方法1:直接端口转发到Prometheus Pod的9090端口
无需依赖socat,直接通过oc port-forward将本地端口映射到Prometheus Pod的9090端口:
oc port-forward -n openshift-monitoring pod/prometheus-k8s-0 9090:9090
执行成功后,在本地浏览器访问 http://localhost:9090 即可进入Prometheus UI。
如果不确定可用的Prometheus Pod名称,先执行以下命令查询:
oc get pods -n openshift-monitoring | grep prometheus-k8s
方法2:通过OpenShift控制台跳转
OpenShift 4.13内置控制台提供了直接入口:
- 登录OpenShift Web Console,切换到Monitoring → Metrics页面
- 点击页面右上角的Open Prometheus UI按钮,即可直接跳转至Prometheus界面
方法3:使用OpenShift Proxy访问
通过oc proxy建立本地与OpenShift API Server的代理连接,再通过API路径访问:
- 启动代理服务:
oc proxy --port=8080
- 在本地浏览器访问:
http://localhost:8080/api/v1/namespaces/openshift-monitoring/services/prometheus-k8s:web/proxy/
内容的提问来源于stack exchange,提问作者Ariaeimehr
相关产品推荐
相关产品推荐

