【问题标题】:Fluentd installation instructions for AWS Elasticsearch ServiceAWS Elasticsearch Service 的 Fluentd 安装说明
【发布时间】:2020-12-08 05:00:36
【问题描述】:

我们使用 AWS Elasticsearch Service。我们想将 fluentd 安装到我们的 Kubernetes 集群中。 Fluentd 将日志发送到 AWS Elasticsearch Service。它有关于如何做的任何说明吗?在此链接 https://docs.fluentd.org/v/0.12/articles/kubernetes-fluentd 上,它显示了将日志发送到 Elasticsearch Pod 的步骤。这意味着elasticsearch安装在Kubernetes集群内部。

上面的链接显示了对弹性搜索 pod 的 fluentd-daemonset-elasticsearch.yaml(见下文)进行更改。我需要对 AWS elasticsearch 服务进行哪些配置更改?

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: kube-system
  ...
spec:
    ...
    spec:
      containers:
      - name: fluentd
        image: quay.io/fluent/fluentd-kubernetes-daemonset
        env:
          - name:  FLUENT_ELASTICSEARCH_HOST
            value: "elasticsearch-logging"
          - name:  FLUENT_ELASTICSEARCH_PORT
            value: "9200"
            ......

【问题讨论】:

标签: amazon-web-services elasticsearch kubernetes elasticsearch-5


【解决方案1】:

假设您具有所需的连接性。例如,Kubernetes 和 Elasticsearch 在同一个 VPC 上,或者如果在不同的 VPC 中你配置了 VPC peering

此外,您有防火墙规则 (Security Groups) 以允许端口 9200 从 Kubernetes 到 Elasticsearch 集群。

应该是直截了当的(只需将配置指向 AWS Elasticsearch 集群端点):

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: kube-system
  ...
spec:
    ...
    spec:
      containers:
      - name: fluentd
        image: quay.io/fluent/fluentd-kubernetes-daemonset
        env:
          - name:  FLUENT_ELASTICSEARCH_HOST
            value: "vpc-domain-name-identifier.region.es.amazonaws.com" ?
          - name:  FLUENT_ELASTICSEARCH_PORT
            value: "9200"
            ......

这是在您使用 VPC 的情况下。如果您以这种方式配置集群,您也可以使用公共 Elasticsearch 端点。 (但由于您正在通过公共云,因此安全性较低)。像这样的:

https://search-domain-name-identifier.region.es.amazonaws.com

✌️

【讨论】:

  • 嗨,Rico,它有效。谢谢你。跟进问题。我将 fluentd 部署为 kube-system 命名空间中的 Daemonset。 kubectl log pod 和 kubectl describe pod 没有显示错误,也没有警告。我们将 csc 应用程序部署到 csc 命名空间。为了收集 csc 的日志,是否还需要在 csc 命名空间中部署 fluentd?
  • 不,它应该从所有命名空间中收集。
  • 嗨,Rico,我们的集群中安装了第三方应用程序。像 datadog、premetheus、grafana 等。我们不希望将这些应用程序的日志发送到 elasticsearch。我们不想发送 kube-system 的日志,也不想发送 kube-public 的日志。我们只想将 csc 应用程序的日志发送到 elasticsearch。我将 fluentd 部署为 csc 命名空间中的守护进程。但是,它会发送整个集群日志。如何只发送 csc 的日志?
  • 您必须更改配置文件以收集仅来自该命名空间的模式。例如:zebrium.com/blog/how-fluentd-collects-kubernetes-metadata。从安全角度来看,您可以使用 RBAC:github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter/… 或者您可以只使用 Filebeat 而不是 Fluentd elastic.co/guide/en/beats/filebeat/current/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-22
  • 1970-01-01
  • 1970-01-01
  • 2017-05-27
  • 1970-01-01
相关资源
最近更新 更多