zoukankan      html  css  js  c++  java
  • k8s集群日志

    硬件环境:

    三台虚拟机,

    10.10.20.203 部署docker、etcd、flannel、kube-apiserver、kube-controller-manager、kube-scheduler、elsticsearch、kibana

    10.10.20.206 部署docker、flannel、kubelet、kube-proxy、filebeat

    10.10.20.207 部署docker、flannel、kubelet、kube-proxy、filebeat

    【elsticsearch】

    1、下载rpm安装包,wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.3.5/elasticsearch-2.3.5.rpm

    2、安装,yum localinstall elasticsearch-2.3.5.rpm

    3、修改配置文件,vi /etc/elasticsearch/elasticsearch.yml

    network.host: 10.10.20.203

    4、重启服务

    systemctl enable elasticsearch.service
    systemctl restart elasticsearch.service
    systemctl status elasticsearch.service

    【kibana】

    1、下载rpm安装包,wget https://download.elastic.co/kibana/kibana/kibana-4.5.4-1.x86_64.rpm

    2、安装,yum localinstall kibana-4.5.4-1.x86_64.rpm

    3、修改配置文件,vi /opt/kibana/config/kibana.yml

    elasticsearch.url: "http://10.10.20.203:9200"

    4、重启服务

    systemctl enable kibana.service
    systemctl restart kibana.service
    systemctl status kibana.service -l

    【filebeat】

    在需要搜集日志的服务器上安装filebeat

    1、下载rpm安装包,wget https://download.elastic.co/beats/filebeat/filebeat-1.2.3-x86_64.rpm

    2、安装,yum localinstall filebeat-1.2.3-x86_64.rpm

    3、修改配置文件,vi /etc/filebeat/filebeat.yml

    filebeat:
      prospectors:
        -
          paths:
            - /var/log/messages
          input_type: log
          document_type: syslog
        -
          paths:
            - /opt/logs/tomcatlog/catalina.*.log
          input_type: log
          document_type: tomcatlog
        -
          paths:
            - //var/lib/docker/containers/*/*-json.log
          input_type: log
          document_type: containerlog
      registry_file: /var/lib/filebeat/registry
     
    output:
      elasticsearch:
        hosts: ["10.10.20.203:9200"]
        index: "filebeat"

    4、重启服务

    systemctl enable filebeat
    systemctl restart filebeat
    systemctl status filebeat -l

    5、访问http://10.10.20.203:5601/,新建filebeat-*这个index,即可查看日志

  • 相关阅读:
    OAuth2.0的四种授权模式
    Jedis整合单机、Sentinel和Cluster模式
    Redis Cluste部署
    Web-动态页面
    Web开发-Servlet&HTTP&Request
    Ajax&Json
    Web开发之Tomcat&Servlet
    PagedListCore的使用
    自己写一个依赖注入容器Container
    在core2.0中实现按程序集注入依赖
  • 原文地址:https://www.cnblogs.com/puroc/p/5822522.html
Copyright © 2011-2022 走看看