【发布时间】:2019-11-02 06:05:57
【问题描述】:
我正在 Kubernetes 中为多个客户端实施一个解决方案,我想使用 Prometheus 监控我的集群。但是,因为这可以快速扩展,并且我想降低成本,所以我将使用 Federation for Prometheus,来抓取 Kubernetes 的不同集群,但我需要公开我的 Prometheus 部署。
我已经使用服务类型 LoadBalancer 公开了我的 Prometheus 部署,但是这种方法将这笔额外费用添加到了我的基础设施 (Digital Ocean LB)。
是否可以使用服务类型 NodePort 来实现这一点,将端口暴露给我的集群 IP,如下所示:
XXXXXXXXXXXXXXXXXX.k8s.ondigitalocean.com:9090
我可以在哪里使用这个 URL 到我的主 Prometheus 报废所有“从属”Prometheus 实例?
我已经尝试过了,但我无法访问我的集群端口。有什么东西挡住了。我还删除了我的防火墙,以确保不会干扰此实现,但没有任何干扰。
这是我的服务:
Name: my-nodeport-service
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"my-nodeport-service","namespace":"default"},"spec":{"ports":[{"na...
Selector: app=nginx
Type: NodePort
IP: 10.245.162.125
Port: http 80/TCP
TargetPort: 80/TCP
NodePort: http 30800/TCP
Endpoints: 10.244.2.220:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
Can anybody help me please?
---
This is my service:
```kubectl describe service my-nodeport-service
Name: my-nodeport-service
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"my-nodeport-service","namespace":"default"},"spec":{"ports":[{"na...
Selector: app=nginx
Type: NodePort
IP: 10.245.162.125
Port: http 80/TCP
TargetPort: 80/TCP
NodePort: http 30800/TCP
Endpoints: 10.244.2.220:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
【问题讨论】:
-
请显示服务定义,
kubectl describe <svc>输出,iptables -L和iptables -t nat -L输出。 -
@AndyShinn 你可以在下面的帖子中找到我的服务。关于 iptables,我无法显示这些命令的输出,因为我在我的 DO 帐户页面中编辑了 DO 的防火墙。
标签: kubernetes digital-ocean kubernetes-service