我应该使用 Pod 还是 Endpoint 的 Prometheus Kubernetes SD 配置?
Should I use a Prometheus Kubernetes SD config of Pod or Endpoint?
Prometheus 在其 Kubernetes SD config
中支持多个角色
我对是否应该为我的部署 + 服务使用 Pod config or a endpoints 角色感到困惑。
我监控的服务是 Deployment
apiVersion: apps/v1
kind: Deployment
spec:
replicas: ~10
strategy:
rollingUpdate:
maxSurge: 5
maxUnavailable: 0
type: RollingUpdate
template:
containers:
- name: web-app
ports:
- containerPort: 3182
name: http
- containerPort: 6060
name: metrics
apiVersion: v1
kind: Service
metadata:
name: web-app
spec:
ports:
- name: http
port: 3182
targetPort: http
selector:
app: web-app
type: ClusterIP
pods 的数量可能因部署而异。部署不断更新为新图像。
我可以根据需要向这些 YAML 文件中的任何一个添加注释或标签。
是否有理由更喜欢 Pod 角色或 Endpoints 角色?
简而言之,有两个主要区别:
endpoints
角色在标签中为您提供更多数据(例如,pod 属于哪个服务);
- a
pod
角色目标 any pod 在那里,而不仅仅是那些属于服务的 pod。
什么最适合您,由您决定,但我认为 endpoints
角色很适合您的生产应用程序(所有这些通常都有相应的服务),而 pod
其他一切的角色。或者你可以只用一个 pod
角色工作来完成所有事情,并通过 kube-state-metrics 导出器带来额外的信息。
Prometheus 在其 Kubernetes SD config
中支持多个角色我对是否应该为我的部署 + 服务使用 Pod config or a endpoints 角色感到困惑。
我监控的服务是 Deployment
apiVersion: apps/v1
kind: Deployment
spec:
replicas: ~10
strategy:
rollingUpdate:
maxSurge: 5
maxUnavailable: 0
type: RollingUpdate
template:
containers:
- name: web-app
ports:
- containerPort: 3182
name: http
- containerPort: 6060
name: metrics
apiVersion: v1
kind: Service
metadata:
name: web-app
spec:
ports:
- name: http
port: 3182
targetPort: http
selector:
app: web-app
type: ClusterIP
pods 的数量可能因部署而异。部署不断更新为新图像。
我可以根据需要向这些 YAML 文件中的任何一个添加注释或标签。
是否有理由更喜欢 Pod 角色或 Endpoints 角色?
简而言之,有两个主要区别:
endpoints
角色在标签中为您提供更多数据(例如,pod 属于哪个服务);- a
pod
角色目标 any pod 在那里,而不仅仅是那些属于服务的 pod。
什么最适合您,由您决定,但我认为 endpoints
角色很适合您的生产应用程序(所有这些通常都有相应的服务),而 pod
其他一切的角色。或者你可以只用一个 pod
角色工作来完成所有事情,并通过 kube-state-metrics 导出器带来额外的信息。