【问题标题】:Can't access Grafana(for prometheus) via AWS ELB at Kubernetes无法通过 Kubernetes 的 AWS ELB 访问 Grafana(用于 prometheus)
【发布时间】:2019-03-22 07:44:12
【问题描述】:

我们有一个由多个节点组成的集群,所以我不能做一个 NodePort,只能去我的 node-ip(这是我为测试 prometheus 所做的)。 我在“monitoring”命名空间进行了 helm install stable/prometheus 和 stable/grafana。

到目前为止一切看起来都还不错。

然后,我正在尝试创建一个访问 Grafana 的 LB 服务,该服务已创建,我可以看到 CNAME 指向 AWS 上 ELB 的 A 记录,但是在访问 Grafana 的 URL 时,没有任何反应,没有HTTP 错误,没有问题的页面,什么都没有。

这是service-elb.yaml

apiVersion: v1
kind: Service
metadata:
  name: grafana-lb
  namespace: monitoring
  labels:
    app: grafana
  annotations:
    dns.alpha.kubernetes.io/external: grafana-testing.country.ourdomain 
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:xxxxxx
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: '443'
    service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600'
spec:
  selector:
    app: grafana
    tier: frontend
  type: LoadBalancer
  ports:
    - name: https
      port: 443
      targetPort: 80
    - name: http
      port: 80
      targetPort: 3000
  loadBalancerSourceRanges:
    - somerange
    - someotherrange
    - etc etc 

顺便说一句,如果我不使用 --set rbac.create=false 创建图表,则会出现有关服务帐户的权限错误

我最近为 Kibana 使用了 nginx-proxy-pass,并且还使用了与此类似的 LB 服务,没有任何问题。但我在这里遗漏了一些东西,现在还不知道它是什么。

任何帮助将不胜感激。如果我让它工作,我会更新。

【问题讨论】:

  • 这只是 ELB 问题吗?可以使用集群 IP 访问 Grafana 吗?
  • 抱歉耽搁了。不,转到 ELB URL 不会返回任何内容。
  • 作为更新,我在 ELB 上看到了 OutOfService 实例:/我想我错过了如何正确地将 grafana 的 pod 指向 LB k8s 的服务对象。我在 LB 服务中获取“端点”字段作为 grafana 的 pod 的 IP:PORT。

标签: amazon-web-services kubernetes grafana prometheus


【解决方案1】:

已解决,必须删除“层”选择器并使用如下规范:

    spec:
  selector:
    app: grafana
  type: LoadBalancer
  ports:
    - name: http
      port: 3000

【讨论】:

    猜你喜欢
    • 2018-05-01
    • 2021-01-30
    • 2012-03-14
    • 1970-01-01
    • 2021-08-09
    • 2021-02-04
    • 2018-05-11
    • 2019-11-23
    • 2023-01-18
    相关资源
    最近更新 更多