Giter Site home page Giter Site logo

nthieu29 / kubernetes-logging-setup Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 101 KB

Kubernetes Logging with Graylog and Fluent Bit in an easy and effective way

License: MIT License

Shell 100.00%
kubernetes logging fluent-bit graylog mongodb elasticsearch

kubernetes-logging-setup's Introduction

kubernetes-logging-setup

Kubernetes Logging with Graylog and Fluent Bit in an easy and effective way.

What will we setup

We will setup the centralize logging in Kubernetes as following: Alt text

  • In each node in Kubernetes cluster, there is an agent to collect the logs of all the containers that run on the node, then process the logs and send to Graylog. We use Fluent Bit as log collector agent and deploy it as DaemonSet so that we have all nodes run a copy of a Fluent Bit pod.
  • Graylog takes care all the things for us: Graylog interacts with the logging agents, manages the storage in Elastic Search, provide an easy to use Web UI and a REST API also. Graylog need MongoDB because Graylog uses MongoDB to store metadata (stream, dashboards, roles, etc).

Prerequisites

  • A working Kubernetes cluster (or use Minikube on your local machine).
  • kubectl is installed and configured correctly.

How to setup

All the stuff were already prepared in this repository to help you get the logging system up and running quickly in just 3 steps:

1. Setup Graylog, MongdoDB, Elasticsearch

  • Make sure you set max_map_count to 262144. It's a requirement and recommendation from Elasticsearch, you could refer here for the reason and how-to.

  • Run the command:

    docker-compose -f compose-graylog.yml up
    
  • What does it do? We use docker-compose to define an application with 3 containers MongoDB, Elasticsearch and Graylog, we also configured them to work correctly.

2. Deploy Fluent Bit in Kubernetes

  • Update with your Graylog server IP address in file fluent-bit-configmap.yml.

  • Run the command:

    deploy.sh
    
  • What does it do?

    • Create a new namespace logging.
    • Create the base resources for Fluent Bit: Service Account, Role, RoleBinding.
    • Create ConfigMap for Fluent Bit.
    • Create DaemonSet with Fluent Bit.

3. Configure Input in Graylog

  • Login to Graylog with default username:password (admin:admin) at http://localhost:9000/.
  • Choose System/Inputs.
  • Click Select input, then choose GELF TCP. Click Launch New Input.
  • Give it a meaningful name in Title field, you could modify other fields, then click Save.
  • Your new Input will be displayed, click Show received messages to view your first logs which coming from Kubernetes.

Where to go next

This guide provides a minimum setup that can be used for smaller, non-critical, or test setups. For production environments, please refer Graylog document.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.