我在AKS (Azure的kubernetes)上部署了Prometheus服务器和2个副本,配置如下。
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: prometheus
namespace: monitoring
...
spec:
podMetadata:
version: v2.13.1
replicas: 2
retention: 1d
...因此,我的集群上将有2个prometheus服务器pod。

然后我用loadbalancer公开这个应用程序。
apiVersion: v1
kind: Service
metadata:
name: prometheus
namespace: monitoring
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 9090
selector:
app: prometheus

但是,我怎么知道负载均衡器暴露的是哪个promethus pod呢?负载均衡器似乎只暴露了一个普罗米修斯吊舱。
发布于 2020-07-31 16:48:23
如果您有多个pod副本,则所有pod副本的If都将作为Endpoints添加到服务prometheus中。因此,当流量到达LoadBalancer时,它会将其转发到prometheus服务IP,该服务IP会对流量进行负载平衡,并将其发送到其中一个副本pod。
要检查服务的端点,请使用以下命令
kubectl describe svc prometheus -n monitoring如果您在使用上述命令的Endpoints部分中看到多个IP,这实质上意味着所有这些副本POD都由服务公开。
https://stackoverflow.com/questions/63188326
复制相似问题