Docker 无法在Kubernetes的Grafana仪表板中获取普罗米修斯数据
我在库伯内特斯创建了一个普罗米修斯和格拉法纳装置,如下所述: 安装普罗米修斯:Docker 无法在Kubernetes的Grafana仪表板中获取普罗米修斯数据,docker,kubernetes,grafana,prometheus,Docker,Kubernetes,Grafana,Prometheus,我在库伯内特斯创建了一个普罗米修斯和格拉法纳装置,如下所述: 安装普罗米修斯: helm install \ --namespace=monitoring \ --name=prometheus \ --set server.persistentVolume.enabled=false \ --set alertmanager.persistentVolume.enabled=false \ stable/prometheus 设置grafana: he
helm install \
--namespace=monitoring \
--name=prometheus \
--set server.persistentVolume.enabled=false \
--set alertmanager.persistentVolume.enabled=false \
stable/prometheus
设置grafana:
helm install \
--namespace=monitoring \
--name=grafana \
--version=1.12.0 \
--set=adminUser=admin \
--set=adminPassword=admin \
--set=service.type=NodePort \
stable/grafana
kubectl get pods -n monitoring
NAME READY STATUS RESTARTS AGE
grafana-6d4f6ff6d5-vw8r2 1/1 Running 0 17h
prometheus-alertmanager-6cb6bc6b7-76fs4 2/2 Running 0 17h
prometheus-kube-state-metrics-5ff476d674-c7mpt 1/1 Running 0 17h
prometheus-node-exporter-4zhmk 1/1 Running 0 17h
prometheus-node-exporter-g7jqm 1/1 Running 0 17h
prometheus-node-exporter-sdnwg 1/1 Running 0 17h
prometheus-pushgateway-7967b4cf45-j24hx 1/1 Running 0 17h
prometheus-server-5dfc4f657d-sl7kv 2/2 Running 0 17h
我可以从grafana容器内部卷曲到我的prometheus容器(它回答“找到”)
Grafana配置:
Name: prometheus
Type: Prometheus
http://prometheus-server
我在一个名为Prometheus 2.0 stats的默认仪表板中看到了指标。
我已经创建了自己的仪表板(github链接中也有描述)
我已经部署了正在运行的应用程序,我经常将其卷曲,但在我的仪表板上什么也看不到
kubectl get pods
NAME READY STATUS RESTARTS AGE
my-app-7bd4b55cbd-8zm8b 1/1 Running 0 17h
my-app-7bd4b55cbd-nzs2p 1/1 Running 0 17h
my-app-7bd4b55cbd-zts78 1/1 Running 0 17h
卷曲
我如何调试这个或我做错了什么
更新:
我的应用程序部署配置
kubectl describe deployment my-app
Name: my-app
Namespace: default
CreationTimestamp: Tue, 02 Apr 2019 22:17:31 +0200
Labels: app=my-app
Annotations: deployment.kubernetes.io/revision: 2
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"my-app"},"name":"my-app","namespace":"default"},...
Selector: app=my-app
Replicas: 3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType: Recreate
MinReadySeconds: 0
Pod Template:
Labels: app=my-app
version=v2.0.0
Annotations: prometheus.io/port: 9101
prometheus.io/scrape: true
Containers:
my-app:
Image: containersol/k8s-deployment-strategies
Ports: 8080/TCP, 8086/TCP
Host Ports: 0/TCP, 0/TCP
Liveness: http-get http://:probe/live delay=5s timeout=1s period=5s #success=1 #failure=3
Readiness: http-get http://:probe/ready delay=0s timeout=1s period=5s #success=1 #failure=3
Environment:
VERSION: v2.0.0
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: my-app-7bd4b55cbd (3/3 replicas created)
Events: <none>
在部署中,您说过要废弃端口9101,但没有在容器上发布此端口
端口9101或8080/8086上的prometheus端点在哪里?能否为我的应用程序添加部署规范?可能是缺少标签,prometheus会根据部署中设置的标签在kubernetes中删除应用程序。@Blokje5已更新
while sleep 0.1; do curl http://192.168.50.10:30513/; done
Host: my-app-7bd4b55cbd-8zm8b, Version: v2.0.0
Host: my-app-7bd4b55cbd-zts78, Version: v2.0.0
Host: my-app-7bd4b55cbd-nzs2p, Version: v2.0.0
Host: my-app-7bd4b55cbd-8zm8b, Version: v2.0.0
Host: my-app-7bd4b55cbd-zts78, Version: v2.0.0
Host: my-app-7bd4b55cbd-zts78, Version: v2.0.0
Host: my-app-7bd4b55cbd-8zm8b, Version: v2.0.0
Host: my-app-7bd4b55cbd-8zm8b, Version: v2.0.0
kubectl describe deployment my-app
Name: my-app
Namespace: default
CreationTimestamp: Tue, 02 Apr 2019 22:17:31 +0200
Labels: app=my-app
Annotations: deployment.kubernetes.io/revision: 2
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"my-app"},"name":"my-app","namespace":"default"},...
Selector: app=my-app
Replicas: 3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType: Recreate
MinReadySeconds: 0
Pod Template:
Labels: app=my-app
version=v2.0.0
Annotations: prometheus.io/port: 9101
prometheus.io/scrape: true
Containers:
my-app:
Image: containersol/k8s-deployment-strategies
Ports: 8080/TCP, 8086/TCP
Host Ports: 0/TCP, 0/TCP
Liveness: http-get http://:probe/live delay=5s timeout=1s period=5s #success=1 #failure=3
Readiness: http-get http://:probe/ready delay=0s timeout=1s period=5s #success=1 #failure=3
Environment:
VERSION: v2.0.0
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: my-app-7bd4b55cbd (3/3 replicas created)
Events: <none>
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 3
strategy:
type: Recreate
# The selector field tell the deployment which pod to update with
# the new version. This field is optional, but if you have labels
# uniquely defined for the pod, in this case the "version" label,
# then we need to redefine the matchLabels and eliminate the version
# field from there.
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
version: v2.0.0
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9101"
spec:
containers:
- name: my-app
image: containersol/k8s-deployment-strategies
ports:
- name: http
containerPort: 8080
- name: probe
containerPort: 8086
env:
- name: VERSION
value: v2.0.0
livenessProbe:
httpGet:
path: /live
port: probe
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: probe
periodSeconds: 5