Kubernetes:1.10.2
普罗米修斯:2.2.1
apiVersion: apps/v1
kind: Deployment
metadata:
name: xxx
namespace: xxx
spec:
selector:
matchLabels:
app: xxx
template:
metadata:
labels:
app: xxx
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
spec:
containers:
- name: container-1
image: xxx
ports:
- containerPort: 443
- name: container-2
image: xxx
ports:
- containerPort: 8080
- job_name: kubernetes-pods
scrape_interval: 1m
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
kubernetes_sd_configs:
- api_server: null
role: pod
namespaces:
names: []
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
separator: ;
regex: "true"
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
separator: ;
regex: (.+)
target_label: __metrics_path__
replacement: $1
action: replace
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
separator: ;
regex: ([^:]+)(?::\d+)?;(\d+)
target_label: __address__
replacement: $1:$2
action: replace
- separator: ;
regex: __meta_kubernetes_pod_label_(.+)
replacement: $1
action: labelmap
- source_labels: [__meta_kubernetes_namespace]
separator: ;
regex: (.*)
target_label: kubernetes_namespace
replacement: $1
action: replace
- source_labels: [__meta_kubernetes_pod_name]
separator: ;
regex: (.*)
target_label: kubernetes_pod_name
replacement: $1
action: replace
我发现了一个GIST片段,如果容器名为“metrics”,它将直接从容器中获取端口,而不是依赖于per-pod注释。它还包含一个注释,使其成为任何以“metrics”开头的端口的regex。
也许您可以扩展它以从端口名称中提取模式,比如“metrics-http”和“metrics-https”。
https://gist.github.com/bakins/5bf7d4e719f36c1c555d81134d8887eb
# Example scrape config for pods
#
# The relabeling allows the actual pod scrape endpoint to be configured via the
# following annotations:
#
# * `prometheus.io/scrape`: Only scrape pods that have a value of `true`
# * `prometheus.io/path`: If the metrics path is not `/metrics` override this. This
# will be the same for every container in the pod that is scraped.
# * this will scrape every container in a pod with `prometheus.io/scrape` set to true and the
port is name `metrics` in the container
# * note `prometheus.io/port` is no longer honored. You must name the port(s) to scrape `metrics`
# Also, in some of the issues I read, there was mention of a container role, but I couldn't get
# that to work - or find any more info on it.
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_container_port_name]
action: keep
regex: metrics
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [ __address__, __meta_kubernetes_pod_container_port_number]
action: replace
regex: (.+):(?:\d+);(\d+)
replacement: ${1}:${2}
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name
我有一个使用http和https的SpringBoot 2.0应用程序。因此,在端口9080上,它服务于http协议,在端口9443上,它工作正常。我唯一想要的是重定向,如果用户输入例如:http://localhost:9443/e1 综上所述: http://localhost:9080/e1 https://localhost:9443/e1 http://localhost:9443/e1
我已经设置了普罗米修斯,通过跟踪普罗米修斯留档来监控库本内斯的指标。 普罗米修斯现在有很多有用的指标。 但是,我看不到任何引用我的pod或节点状态的指标。 理想情况下-我希望能够绘制pod状态(运行,挂起,CrashLoopBackoff,错误)和节点(NodeNow,就绪)。 这个度量单位在哪里?如果没有,我可以添加到某个地方吗?怎么做?
我有一个部署在Glassfish上的应用程序,并侦听端口8181以获取HTTPS流量(当前)。问题是在部署时,客户很少为服务器创建有效证书。这意味着HTTPS无法通过证书检查。 在我们的应用程序中,我们希望通过HTTP获取某些类型的内容,因为它是静态的,并且获取未加密这一事实不是问题。 我们确实存在的问题是,只有端口8181可供用户使用(防火墙等不能更改)。 因此,我们需要一种方法让Glassfi
我的网关文件为 我可以确认apache只侦听443,并且配置正确
http/https 端口与 ws端口 冲突吗?
我有一个kubernetes V1.12.1集群运行我的一些工作负载。我想设置HPA,这样我就可以根据来自普罗米修斯节点导出器的度量标准来衡量一个特定的吊舱。