博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
kubernetes上部署Fluentd+Elasticsearch+kibana日志收集系统
阅读量:6478 次
发布时间:2019-06-23

本文共 3188 字,大约阅读时间需要 10 分钟。

hot3.png

kubernetes上部署Fluentd+Elasticsearch+kibana日志收集系统 博客分类: Kubernetes

kubernetes上部署Fluentd+Elasticsearch+kibana日志收集系统

1  工具介绍

Fluentd:用于收集、处理、传输日志数据。

Elasticsearch:用于实时查询和解析数据。
Kibana:用于数据可视化。

2  工作流程

Fluentd收集日志,将日志过滤处理后输出到Elasticsearch中,Elasticsearch的watcher插件将异常信息通过邮件发送给相关负责人。Kibana配置上ES服务接口,通过Kibana服务访问即可。
 

3  安装

三个工具全部运行在kubernettes上。
 
fluentd.yaml配置文件
apiVersion: v1
kind: Pod
metadata:
  name: fluentd
spec:
  containers:
  - name: fluentd-es
    image: index.tenxcloud.com/google_containers/fluentd-elasticsearch:1.9
    imagePullPolicy: Never
    env:
      - name: FLUENTD_ARGS
        value: -qq
    volumeMounts:
      - name: containers
        mountPath: /var/lib/docker/containers
      - name: varlog
        mountPath: /varlog
      - name: podlog
        mountPath: /var/lib/kubelet/pods
  volumes:
    - name: containers
      hostPath:
        path: /var/lib/docker/containers
    - name: varlog
      hostPath:
        path: /var/log
    - name: podlog
      hostPath:
        path: /var/lib/kubelet/pods
 
Elasticsearch-rc.yaml配置文件
apiVersion: v1
kind: ReplicationController
metadata:
  name: elasticsearch
  labels:
    name: elasticsearch-logging
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    name: elasticsearch-logging
  template:
    metadata:
      name: es
      labels:
        name: elasticsearch-logging
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
        - image: index.tenxcloud.com/google_containers/elasticsearch:1.4
          imagePullPolicy: Never
          name: elasticsearch-logging
          ports:
            - name: es-port
              containerPort: 9200
            - name: es-tran-port
              containerPort: 9300
          volumeMounts:
            - name: es-persistent-storage
              mountPath: /data
      volumes:
        - name: es-persistent-storage
          emptyDir: {}
 
Elasticsearch-service.yaml配置文件
apiVersion: v1
kind: Service
metadata:
  name: elasticsearch-logging
  labels:
    name: elasticsearch-logging
    kubernetes.io/cluster-service: "true"
spec:
  # if your cluster supports it, uncomment the following to automatically create
  # an external load-balanced IP for the frontend service.
  type: NodePort
  ports:
    # the port that this service should serve on
  - port: 9200
    targetPort: 9200
    nodePort: 30009
#  - containerPort: 9200
  selector:
    name: elasticsearch-logging
 
kibana-rc.yaml文件
apiVersion: v1
kind: ReplicationController
metadata:
  name: kibana-logging
  labels:
    name: kibana-logging
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    name: kibana-logging
  template:
    metadata:
      name: kibana
      labels:
        name: kibana-logging
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
        - image: gcr.io/google_containers/kibana:1.3
          name: kibana-logging
          imagePullPolicy: Never
          env:
            - name: "ES_SCHEME"
              value: "http"
            - name: "ES_HOST"
              value: "<your-ip>/api/v1/proxy/namespaces/default/services/elasticsearch-logging/" 
          ports:
            - name: kibana-port
              containerPort: 80
 
kibana-service.yaml配置文件
apiVersion: v1
kind: Service
metadata:
  name: kibana-logging
  labels:
    name: kibana-logging
    kubernetes.io/cluster-service: "true"
spec:
  # if your cluster supports it, uncomment the following to automatically create
  # an external load-balanced IP for the frontend service.
  # type: LoadBalancer
  ports:
    # the port that this service should serve on
  - port: 5601
    targetPort: 80
#  - containerPort: 9200
  selector:
    name: kibana-logging
 
http://blog.csdn.net/ptmozhu/article/details/52301174

转载于:https://my.oschina.net/xiaominmin/blog/1598543

你可能感兴趣的文章
Linux Curl命令
查看>>
046 SparlSQL中的函数
查看>>
-27979 LoadRunner 错误27979 找不到请求表单 Action.c(73): Error -27979: Requested form not found...
查看>>
[LeetCode] Minimum Depth of Binary Tree
查看>>
,net运行框架
查看>>
Java 中 Emoji 的正则表达式
查看>>
Mixin Network第一届开发者大赛作品介绍- dodice, diceos和Fox.one luckycoin
查看>>
安卓Glide(4.7.1)使用笔记 01 - 引入项目
查看>>
中金易云:为出版社找到下一本《解忧杂货店》
查看>>
Flex布局
查看>>
Material Design之 AppbarLayout 开发实践总结
查看>>
Flutter之MaterialApp使用详解
查看>>
DataBinding最全使用说明
查看>>
原生Js交互之DSBridge
查看>>
Matlab编程之——卷积神经网络CNN代码解析
查看>>
白洋淀周末游
查看>>
三篇文章了解 TiDB 技术内幕 —— 说计算
查看>>
copy strong weak assign的区别
查看>>
OpenCV 入门
查看>>
css 3D transform变换
查看>>