首页 > 解决方案 > Prometheus Pushgateway 的访问控制

问题描述

我们有一个 Prometheus Pushgateway 正在运行并监听来自我们的 AWS Lambda 函数的指标推送。但是,公众可以访问 Pushgateway 的 URL,这可能会带来一些安全问题。我们想知道是否有任何方法可以为 Pushgateway 添加一层保护,使其不可公开访问?

我发现这个 Github 线程可以回答这个问题: https ://github.com/prometheus/pushgateway/issues/281

它建议在pushgateway前面设置一个反向代理。但是,我仍然对这实际上如何工作感到困惑?我们目前正在使用 Kubernetes 来部署 Prometheus。

标签: securitynetworkingprometheusprometheus-pushgateway

解决方案


您可以使用 TLS 机密作为入口规则,在入口控制器中包含身份验证。这是一个示例,显示如何为您的入口生成基本身份验证:

https://kubernetes.github.io/ingress-nginx/examples/auth/basic/

此外,不要忘记在您的客户端中包含 Python 处理程序函数来设置 auth 标头,如下所示:

https://github.com/prometheus/client_python#handlers-for-authentication


推荐阅读