普羅米修斯 (Prometheus) 是一個可以提供 Kubernetes 應用程式量測的開源套件, 一方面可以彙整量測資訊, 也可以提供警告 (Alert) 通知.
本篇筆記將介紹如何安裝與使用 Prometheus 套件
stable/prometheus --name pro-demo -f .\stable\pachyderm\values.yaml
安裝 PrometheusPS C:\k8s\charts> helm install stable/prometheus --name pro-demo -f .\stable\pachyderm\values.yaml
NAME: pro-demo
LAST DEPLOYED: Thu Nov 1 00:07:34 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1beta1/ClusterRoleBinding
NAME AGE
pro-demo-prometheus-kube-state-metrics 0s
pro-demo-prometheus-server 0s
==> v1beta1/DaemonSet
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
pro-demo-prometheus-node-exporter 1 1 0 1 0 <none> 0s
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
pro-demo-prometheus-alertmanager 1 1 1 0 0s
pro-demo-prometheus-kube-state-metrics 1 1 1 0 0s
pro-demo-prometheus-pushgateway 1 1 1 0 0s
pro-demo-prometheus-server 1 1 1 0 0s
==> v1/ConfigMap
NAME DATA AGE
pro-demo-prometheus-alertmanager 1 0s
pro-demo-prometheus-server 3 0s
==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pro-demo-prometheus-alertmanager Pending hostpath 0s
pro-demo-prometheus-server Pending hostpath 0s
==> v1/ServiceAccount
NAME SECRETS AGE
pro-demo-prometheus-alertmanager 1 0s
pro-demo-prometheus-kube-state-metrics 1 0s
pro-demo-prometheus-node-exporter 1 0s
pro-demo-prometheus-pushgateway 1 0s
pro-demo-prometheus-server 1 0s
==> v1beta1/ClusterRole
NAME AGE
pro-demo-prometheus-kube-state-metrics 0s
pro-demo-prometheus-server 0s
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
pro-demo-prometheus-alertmanager ClusterIP 10.110.141.9 <none> 80/TCP 0s
pro-demo-prometheus-kube-state-metrics ClusterIP None <none> 80/TCP 0s
pro-demo-prometheus-node-exporter ClusterIP None <none> 9100/TCP 0s
pro-demo-prometheus-pushgateway ClusterIP 10.102.160.186 <none> 9091/TCP 0s
pro-demo-prometheus-server ClusterIP 10.108.221.100 <none> 80/TCP 0s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
pro-demo-prometheus-node-exporter-84xpx 0/1 ContainerCreating 0 0s
pro-demo-prometheus-alertmanager-5bbb765fbf-mf99t 0/2 Pending 0 0s
pro-demo-prometheus-kube-state-metrics-6768486fc6-6xwt4 0/1 ContainerCreating 0 0s
pro-demo-prometheus-pushgateway-6d75b58669-2vhxc 0/1 ContainerCreating 0 0s
pro-demo-prometheus-server-6b78f68f-449pw 0/2 Pending 0 0s
NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:
pro-demo-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[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9090
The Prometheus alertmanager can be accessed via port 80 on the following DNS name from within your cluster:
pro-demo-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[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9093
The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster:
pro-demo-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[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9091
For more information on running Prometheus, visit:
https://prometheus.io/
PS C:\k8s\charts> kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}"
pro-demo-prometheus-server-6b78f68f-s2l94
PS C:\k8s\charts> kubectl --namespace default port-forward pro-demo-prometheus-server-6b78f68f-s2l94 9090
Forwarding from 127.0.0.1:9090 -> 9090
Forwarding from [::1]:9090 -> 9090