设为首页 收藏本站
查看: 811|回复: 0

[经验分享] kubernetes addons efk-BravePro

[复制链接]

尚未签到

发表于 2018-9-15 14:06:05 | 显示全部楼层 |阅读模式
apiVersion: v1  
kind: ConfigMap
  
metadata:
  
  name: fluentd-config
  
  namespace: "kube-system"
  
data:
  
  fluentd.conf: |
  
    # This configuration file for Fluentd / td-agent is used
  
    # to watch changes to Docker log files. The kubelet creates symlinks that
  
    # capture the pod name, namespace, container name & Docker container ID
  
    # to the docker logs for pods in the /var/log/containers directory on the host.
  
    # If running this fluentd configuration in a Docker container, the /var/log
  
    # directory should be mounted in the container.
  
    #
  
    # These logs are then submitted to Elasticsearch which assumes the
  
    # installation of the fluent-plugin-elasticsearch & the
  
    # fluent-plugin-kubernetes_metadata_filter plugins.
  
    # See https://github.com/uken/fluent-plugin-elasticsearch &
  
    # https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter for
  
    # more information about the plugins.
  
    # Maintainer: Jimmi Dyson
  
    #
  
    # Example
  
    # =======
  
    # A line in the Docker log file might look like this JSON:
  
    #
  
    # {"log":"2014/09/25 21:15:03 Got request with path wombat\n",
  
    #  "stream":"stderr",
  
    #   "time":"2014-09-25T21:15:03.499185026Z"}
  
    #
  
    # The time_format specification below makes sure we properly
  
    # parse the time format produced by Docker. This will be
  
    # submitted to Elasticsearch and should appear like:
  
    # $ curl 'http://elasticsearch-logging:9200/_search?pretty'
  
    # ...
  
    # {
  
    #      "_index" : "logstash-2014.09.25",
  
    #      "_type" : "fluentd",
  
    #      "_id" : "VBrbor2QTuGpsQyTCdfzqA",
  
    #      "_score" : 1.0,
  
    #      "_source":{"log":"2014/09/25 22:45:50 Got request with path wombat\n",
  
    #                 "stream":"stderr","tag":"docker.container.all",
  
    #                 "@timestamp":"2014-09-25T22:45:50+00:00"}
  
    #    },
  
    # ...
  
    #
  
    # The Kubernetes fluentd plugin is used to write the Kubernetes metadata to the log
  
    # record & add labels to the log record if properly configured. This enables users
  
    # to filter & search logs on any metadata.
  
    # For example a Docker container's logs might be in the directory:
  
    #
  
    #  /var/lib/docker/containers/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b
  
    #
  
    # and in the file:
  
    #
  
    #  997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b-json.log
  
    #
  
    # where 997599971ee6... is the Docker ID of the running container.
  
    # The Kubernetes kubelet makes a symbolic link to this file on the host machine
  
    # in the /var/log/containers directory which includes the pod name and the Kubernetes
  
    # container name:
  
    #
  
    #    synthetic-logger-0.25lps-pod_default_synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log
  
    #    ->
  
    #    /var/lib/docker/containers/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b-json.log
  
    #
  
    # The /var/log directory on the host is mapped to the /var/log directory in the container
  
    # running this instance of Fluentd and we end up collecting the file:
  
    #
  
    #   /var/log/containers/synthetic-logger-0.25lps-pod_default_synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log
  
    #
  
    # This results in the tag:
  
    #
  
    #  var.log.containers.synthetic-logger-0.25lps-pod_default_synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log
  
    #
  
    # The Kubernetes fluentd plugin is used to extract the namespace, pod name & container name
  
    # which are added to the log message as a kubernetes field object & the Docker container ID
  
    # is also added under the docker field object.
  
    # The final tag is:
  
    #
  
    #   kubernetes.var.log.containers.synthetic-logger-0.25lps-pod_default_synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log
  
    #
  
    # And the final log record look like:
  
    #
  
    # {
  
    #   "log":"2014/09/25 21:15:03 Got request with path wombat\n",
  
    #   "stream":"stderr",
  
    #   "time":"2014-09-25T21:15:03.499185026Z",
  
    #   "kubernetes": {
  
    #     "namespace": "default",
  
    #     "pod_name": "synthetic-logger-0.25lps-pod",
  
    #     "container_name": "synth-lgr"
  
    #   },
  
    #   "docker": {
  
    #     "container_id": "997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b"
  
    #   }
  
    # }
  
    #
  
    # This makes it easier for users to search for logs by pod name or by
  
    # the name of the Kubernetes container regardless of how many times the
  
    # Kubernetes pod has been restarted (resulting in a several Docker container IDs).
  
    #
  
    # TODO: Propagate the labels associated with a container along with its logs
  
    # so users can query logs using labels as well as or instead of the pod name
  
    # and container name. This is simply done via configuration of the Kubernetes
  
    # fluentd plugin but requires secrets to be enabled in the fluent pod. This is a
  
    # problem yet to be solved as secrets are not usable in static pods which the fluentd
  
    # pod must be until a per-node controller is available in Kubernetes.
  
    # Prevent fluentd from handling records containing its own logs. Otherwise
  
    # it can lead to an infinite loop, when error in sending one message generates
  
    # another message which also fails to be sent and so on.
  
   
  
      type null
  
   
  
    # Example:
  
    # {"log":"[info:2016-02-16T16:04:05.930-08:00] Some log text here\n","stream":"stdout","time":"2016-02-17T00:04:05.931087621Z"}
  
   
  
      type tail
  
      path /var/log/containers/*.log
  
      pos_file /var/log/es-containers.log.pos
  
      time_format %Y-%m-%dT%H:%M:%S.%NZ
  
      tag kubernetes.*
  
      format json
  
      read_from_head true
  
   
  
    # Example:
  
    # 2015-12-21 23:17:22,066 [salt.state       ][INFO    ] Completed state [net.ipv4.ip_forward] at time 23:17:22.066081
  
   
  
      type tail
  
      format /^(?[^ ]* [^ ,]*)[^\[]*\[[^\]]*\]\[(?[^ \]]*) *\] (?.*)$/
  
      time_format %Y-%m-%d %H:%M:%S
  
      path /var/log/salt/minion
  
      pos_file /var/log/es-salt.pos
  
      tag salt
  
   
  
    # Example:
  
    # Dec 21 23:17:22 gke-foo-1-1-4b5cbd14-node-4eoj startupscript: Finished running startup script /var/run/google.startup.script
  
   
  
      type tail
  
      format syslog
  
      path /var/log/startupscript.log
  
      pos_file /var/log/es-startupscript.log.pos
  
      tag startupscript
  
   
  
    # Examples:
  
    # time="2016-02-04T06:51:03.053580605Z" level=info msg="GET /containers/json"
  
    # time="2016-02-04T07:53:57.505612354Z" level=error msg="HTTP Error" err="No such image: -f" statusCode=404
  
   
  
      type tail
  
      format /^time="(?[^)]*)" level=(?[^ ]*) msg="(?[^"]*)"( err="(?[^"]*)")?( statusCode=($\d+))?/
  
      path /var/log/docker.log
  
      pos_file /var/log/es-docker.log.pos
  
      tag docker
  
   
  
    # Example:
  
    # 2016/02/04 06:52:38 filePurge: successfully removed file /var/etcd/data/member/wal/00000000000006d0-00000000010a23d1.wal
  
   
  
      type tail
  
      # Not parsing this, because it doesn't have anything particularly useful to
  
      # parse out of it (like severities).
  
      format none
  
      path /var/log/etcd.log
  
      pos_file /var/log/es-etcd.log.pos
  
      tag etcd
  
   
  
    # Multi-line parsing is required for all the kube logs because very large log
  
    # statements, such as those that include entire object bodies, get split into
  
    # multiple lines by glog.
  
    # Example:
  
    # I0204 07:32:30.020537    3368 server.go:1048] POST /stats/container/: (13.972191ms) 200 [[Go-http-client/1.1] 10.244.1.3:40537]
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/kubelet.log
  
      pos_file /var/log/es-kubelet.log.pos
  
      tag kubelet
  
   
  
    # Example:
  
    # I1118 21:26:53.975789       6 proxier.go:1096] Port "nodePort for kube-system/default-http-backend:http" (:31429/tcp) was open before and is still needed
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/kube-proxy.log
  
      pos_file /var/log/es-kube-proxy.log.pos
  
      tag kube-proxy
  
   
  
    # Example:
  
    # I0204 07:00:19.604280       5 handlers.go:131] GET /api/v1/nodes: (1.624207ms) 200 [[kube-controller-manager/v1.1.3 (linux/amd64) kubernetes/6a81b50] 127.0.0.1:38266]
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/kube-apiserver.log
  
      pos_file /var/log/es-kube-apiserver.log.pos
  
      tag kube-apiserver
  
   
  
    # Example:
  
    # I0204 06:55:31.872680       5 servicecontroller.go:277] LB already exists and doesn't need update for service kube-system/kube-ui
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/kube-controller-manager.log
  
      pos_file /var/log/es-kube-controller-manager.log.pos
  
      tag kube-controller-manager
  
   
  
    # Example:
  
    # W0204 06:49:18.239674       7 reflector.go:245] pkg/scheduler/factory/factory.go:193: watch of *api.Service ended with: 401: The event in requested index is outdated and cleared (the requested history has been cleared [2578313/2577886]) [2579312]
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/kube-scheduler.log
  
      pos_file /var/log/es-kube-scheduler.log.pos
  
      tag kube-scheduler
  
   
  
    # Example:
  
    # I1104 10:36:20.242766       5 rescheduler.go:73] Running Rescheduler
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/rescheduler.log
  
      pos_file /var/log/es-rescheduler.log.pos
  
      tag rescheduler
  
   
  
    # Example:
  
    # I0603 15:31:05.793605       6 cluster_manager.go:230] Reading config from path /etc/gce.conf
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/glbc.log
  
      pos_file /var/log/es-glbc.log.pos
  
      tag glbc
  
   
  
    # Example:
  
    # I0603 15:31:05.793605       6 cluster_manager.go:230] Reading config from path /etc/gce.conf
  
   
  
      type tail
  
      format multiline
  
      multiline_flush_interval 5s
  
      format_firstline /^\w\d{4}/
  
      format1 /^(?\w)(?\d{4} [^\s]*)\s+(?\d+)\s+(?[^ \]]+)\] (?.*)/
  
      time_format %m%d %H:%M:%S.%N
  
      path /var/log/cluster-autoscaler.log
  
      pos_file /var/log/es-cluster-autoscaler.log.pos
  
      tag cluster-autoscaler
  
   
  
   
  
      type kubernetes_metadata
  
   
  
    ## Prometheus Exporter Plugin
  
    ## input plugin that exports metrics
  
    #
  
    #  type prometheus
  
    #
  
    #
  
    #  type monitor_agent
  
    #
  
    #
  
    #  type forward
  
    #
  
    ## input plugin that collects metrics from MonitorAgent
  
    #
  
    #  @type prometheus_monitor
  
    #  
  
    #    host ${hostname}
  
    #  
  
    #
  
    ## input plugin that collects metrics for output plugin
  
    #
  
    #  @type prometheus_output_monitor
  
    #  
  
    #    host ${hostname}
  
    #  
  
    #
  
    ## input plugin that collects metrics for in_tail plugin
  
    #
  
    #  @type prometheus_tail_monitor
  
    #  
  
    #    host ${hostname}
  
    #  
  
    #
  
   
  
       type elasticsearch
  
       user "#{ENV['FLUENT_ELASTICSEARCH_USER']}"
  
       password "#{ENV['FLUENT_ELASTICSEARCH_PASSWORD']}"
  
       log_level info
  
       include_tag_key true
  
       host elasticsearch-logging
  
       port 9200
  
       logstash_format true
  
       # Set the chunk limit the same as for fluentd-gcp.
  
       buffer_chunk_limit 2M
  
       # Cap buffer memory usage to 2MiB/chunk * 32 chunks = 64 MiB
  
       buffer_queue_limit 32
  
       flush_interval 5s
  
       # Never wait longer than 5 minutes between retries.
  
       max_retry_wait 30
  
       # Disable the limit on the number of retries (retry forever).
  
       disable_retry_limit
  
       # Use multiple threads for processing.
  
       num_threads 8
  
   



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-583630-1-1.html 上篇帖子: Kubernetes addons Heapster-BravePro 下篇帖子: Kubernetes RBAC (Role-Based Access Control)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表