在 Kubernetes 上通过 helm 安装 Prometheus 后如何访问?
How to access Prometheus after install it by helm on Kubernetes?
在 Kubernetes 集群中安装 Prometheus 使用:
helm install stable/prometheus
成功:
kubectl get pods
NAME READY STATUS RESTARTS AGE
winsome-otter-prometheus-alertmanager-3488774855-mk4ph 2/2 Running 0 5m
winsome-otter-prometheus-kube-state-metrics-2907311046-ggnwx 1/1 Running 0 5m
winsome-otter-prometheus-node-exporter-dp9b3 1/1 Running 0 5m
winsome-otter-prometheus-pushgateway-3103937292-fvw8m 1/1 Running 0 5m
winsome-otter-prometheus-server-2211167584-hjlp6 2/2 Running 0 5m
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 4d
winsome-otter-prometheus-alertmanager ClusterIP 10.0.0.215 <none> 80/TCP 8m
winsome-otter-prometheus-kube-state-metrics ClusterIP None <none> 80/TCP 8m
winsome-otter-prometheus-node-exporter ClusterIP None <none> 9100/TCP 8m
winsome-otter-prometheus-pushgateway ClusterIP 10.0.0.168 <none> 9091/TCP 8m
winsome-otter-prometheus-server ClusterIP 10.0.0.62 <none> 80/TCP 8m
如何从浏览器访问它?使用哪个端口?怎么知道?
您需要先将端口 9090 从本地主机转发到 prometheus pod:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9090
现在您可以在 http://localhost:9090
上通过浏览器访问 Prometheus
您也可以对 alertmanager
执行相同的操作:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9093
现在可以在 http://localhost:9093
上通过浏览器使用 Alertmanager
NOTES:
The Prometheus server can be accessed via port 81 on the following DNS name from within your cluster:
voting-prawn-prometheus-server.default.svc.cluster.local
Get the Prometheus server URL by running these commands in the same shell:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[1].metadata.name}") kubectl --namespace default port-forward $POD_NAME 9091
The Prometheus alertmanager can be accessed via port 81 on the following DNS name from within your cluster:
voting-prawn-prometheus-alertmanager.default.svc.cluster.local
Get the Alertmanager URL by running these commands in the same shell:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[1].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9094
The Prometheus PushGateway can be accessed via port 9092 on the following DNS name from within your cluster:
voting-prawn-prometheus-pushgateway.default.svc.cluster.local
Get the PushGateway URL by running these commands in the same shell:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[1].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9094
For more information on running Prometheus, visit:
https://prometheus.io/
在 Kubernetes 集群中安装 Prometheus 使用:
helm install stable/prometheus
成功:
kubectl get pods
NAME READY STATUS RESTARTS AGE
winsome-otter-prometheus-alertmanager-3488774855-mk4ph 2/2 Running 0 5m
winsome-otter-prometheus-kube-state-metrics-2907311046-ggnwx 1/1 Running 0 5m
winsome-otter-prometheus-node-exporter-dp9b3 1/1 Running 0 5m
winsome-otter-prometheus-pushgateway-3103937292-fvw8m 1/1 Running 0 5m
winsome-otter-prometheus-server-2211167584-hjlp6 2/2 Running 0 5m
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 4d
winsome-otter-prometheus-alertmanager ClusterIP 10.0.0.215 <none> 80/TCP 8m
winsome-otter-prometheus-kube-state-metrics ClusterIP None <none> 80/TCP 8m
winsome-otter-prometheus-node-exporter ClusterIP None <none> 9100/TCP 8m
winsome-otter-prometheus-pushgateway ClusterIP 10.0.0.168 <none> 9091/TCP 8m
winsome-otter-prometheus-server ClusterIP 10.0.0.62 <none> 80/TCP 8m
如何从浏览器访问它?使用哪个端口?怎么知道?
您需要先将端口 9090 从本地主机转发到 prometheus pod:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9090
现在您可以在 http://localhost:9090
上通过浏览器访问 Prometheus您也可以对 alertmanager
执行相同的操作:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9093
现在可以在 http://localhost:9093
上通过浏览器使用 AlertmanagerNOTES:
The Prometheus server can be accessed via port 81 on the following DNS name from within your cluster:
voting-prawn-prometheus-server.default.svc.cluster.local
Get the Prometheus server URL by running these commands in the same shell:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[1].metadata.name}") kubectl --namespace default port-forward $POD_NAME 9091
The Prometheus alertmanager can be accessed via port 81 on the following DNS name from within your cluster:
voting-prawn-prometheus-alertmanager.default.svc.cluster.local
Get the Alertmanager URL by running these commands in the same shell:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[1].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9094
The Prometheus PushGateway can be accessed via port 9092 on the following DNS name from within your cluster:
voting-prawn-prometheus-pushgateway.default.svc.cluster.local
Get the PushGateway URL by running these commands in the same shell:
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[1].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9094
For more information on running Prometheus, visit:
https://prometheus.io/